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 list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal



_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://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