For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > May 2005 > Re: [SMARTY] Arrays how to









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] Arrays how to
Dc

2005-05-08, 8:56 am

you are mixing smarty and javascript syntax!

server side:

{if $imgArr}
<img src=... /> <!-- html code -->
{/if}

also your comments will cause things to choke:
{* this is a smarty comment *}
<!-- html -->
/* javascript */

if you want to do something client side, you will need to escape the
javascript when the smarty processes it. this is probably the error you
are getting, but solving it wont solve your problem (use the method above).

{literal}
if ( imgArr != "" ){
// js stuff
}
{/literal}

(or put the js in a separate .js file)

bon chance!

/dc

On Sun, 08 May 2005 12:19:31 +0900, Reynier Perez Mira
<rperezm@estudiantes.uci.cu> wrote:

> Hi list:
>
> I try to view if a var declared as array contain value or came empty in
> a .tpl file. I try this:
>
> if ($imgArr neq ""){
>
> // actions
>
> }else{
>
> // others actions
>
> }
>
> But this generate a error. Some help with this ?
>
>
> Reynier Pérez Mira
>
> 3ero. Ing. Informática
>
> Entre más inteligente me siento, más me doy cuenta de lo ignorante que
> soy.
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com