On 20-11-2008 at 13:04:30 Szymek Przybył <[EMAIL PROTECTED]> wrote:

And as for the character "&" - it is sometimes used in href of <a> (in $_GET globals), for example:
<a href="index.php?site=team&id=2">Team 2</a>
In this case i don't get any error - well this char is ok in href, in phptal templates?

It is not ok. To insert & character in XHTML you should always use &amp;.

This is correct:
<a href="index.php?site=team&amp;id=2">

(note that it does not change link at all, it's just encoding required to unambiguously insert link in XHTML).

Or maybe it is better to add href to <a>'s by js?

Absolutely not. You would make site useless to UAs without JS for no good reason.

In my main template i have:
<script type="text/javascript" src="inc/jquery-1.2.6.js"/>
<script tal:on-error="" metal:use-macro="sites/${site}.html/js"/>
(including jquery framework and macro of JS scripts for current page)

And is there some method in phptal, to unset these two lines, if there aren't any scripts (no macro "js" defined) in current page template?

No. You're using macros backwards.

Maybe there is some better way to include js scripts for each page in phptal?

page's template:

<tal:block metal:use-macro="page_layout.html/main" tal:define="needs_scripts 'yup'">
<body metal:fill-slot="body">...</body>

main template called by all pages:

<html metal:define-macro="main">
<script tal:condition="exists:needs_scripts" src=".." />
<body metal:define-slot="body"/>

regards, Kornel

PHPTAL mailing list

Reply via email to