[Zope] extract page title

Jeff Rush jeff at taupro.com
Tue Apr 24 10:56:41 EDT 2007


Andreas Jung wrote:
> 
> --On 24. April 2007 15:25:24 +0100 Dean Hale
> <dean.hale at sunderland.ac.uk> wrote:
> 
>> basically if i have some zpt pages with the title
>>
>> <title>INTRODUCTION</title>
>>
>> <title>ABOUT</title>
>>
>> somehow within below the page title should be appended after
>> 'websitename.'
>>
>>> <script language='JavaScript1.1' type='text/javascript'>
>>> <noscript>
>>> <img src="http://domain/xxx/xxx/s?websitename.INTRODUCTION"
>>> width="1" height="1" alt="">
>>> </noscript>
>>> </script>
>>
>>> <script language='JavaScript1.1' type='text/javascript'>
>>> <noscript>
>>> <img src="http://domain/xxx/xxx/s?websitename.ABOUT"
>>> width="1" height="1" alt="">
>>> </noscript>
>>> </script>
>>
>> does this make more sense? thanks again.
> 
> no.
> 
> a <TITLE> tag does not belong inside <script> tag.

I don't see above him putting a <title> tag within the <script> tag.  He wants
to put the *value* of the <title> tag inside the <script> tag.  It seems some
form of a string: expression would do it, assuming the title is not literally
in the zpt but rather expanded from a variable.

<script language='JavaScript1.1' type='text/javascript'>
 <noscript>
<img tal:attributes="src http://domain/xxx/xxx/s?websitename.${title_or_id}"
     width="1" height="1" alt="" />
</noscript>
</script>

Apparently he has named his image files according to the title of the page on
which they appear.  Hopefully the names are not in need of URL-quoting, as I'm
not sure how you do that within a string: expression.

If the value of the <title> is *literally* in the zpt file above his <img>
tag, then I know of no way for a zpt expression to extract literal text from
neighboring text.

-Jeff


More information about the Zope mailing list