and how could I apply this to a tal:repeat ?

I'd like to include some references to external javascriptfiles, if
they were set. For that, I created the following lines in my
template...

<tal:block tal:repeat="jsfile javascriptfiles">
   <script type="text/javascript" src="${jsfile}"></script>
</tal:block>


however, if no javascriptfiles are set, this doesn't work.


I tried with

<tal:block tal:condition="exists javascriptfiles" tal:repeat="jsfile 
javascriptfiles">
 <script type="text/javascript" src="${jsfile}"></script>
</tal:block>

but that also gives an error.



Am I taking the wrong approach, or is there a solution?




>    
>  I also like using the solution that Levi suggests. 
>  
>  Just note that the element's default content will be used if it is
> defined - this has the added value of being able to view your
> template (e.g) in your browser, without any replaced variables.
>  
>  So, note that this will output nothing if pagetitle is not assigned:
>  
>  
> <title tal:content="pagetitle|default"></title>
>  
>  However, this will output "Some Page Title" if pagetitle is not assigned:
>  
>  
> <title tal:content="pagetitle|default">Some Page Title</title>
>  
>  Regards,
>  Werner
>  
>  
>  Levi Stanley wrote: 
>   
> One solution is to do this:

> <title tal:content="pagetitle | default"></title>

> GRolf wrote: 
>   
>   
> When I create a simple template, but don't assign a value to all
> variables in the template, PHPTal throws an error. Is there a way to
> prevent this?

> I'd like to create some placeholders, where I can set variables, but
> they won't all be filled every time.

> e.g.

> <head>

> <title tal:content="pagetitle"></title>

> </head>

> It should also be possible to render this page without setting
> $title...


> _______________________________________________
> PHPTAL mailing
> listphp...@lists.motion-twin.comhttp://lists.motion-twin.com/mailman/listinfo/phptal
>   
>   
> _______________________________________________
> PHPTAL mailing
> listphp...@lists.motion-twin.comhttp://lists.motion-twin.com/mailman/listinfo/phptal
>  
>  
>  
>    


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to