Hi I'm trying to implement some web tracking code within a page template, however a little stuck. In the code below i'd like to append the page template - page title between the <title> tags dynamically rather than having to manually add to each page <script language='JavaScript1.1' type='text/javascript'> <noscript> <img src="http://domain/xxx/xxx/s?websitename.PAGETITLE" width="1" height="1" alt=""> </noscript> </script> do you have any advise please on how this could be done? thanks very much dean
--On 24. April 2007 15:05:49 +0100 Dean Hale <dean.hale@sunderland.ac.uk> wrote:
Hi
I'm trying to implement some web tracking code within a page template, however a little stuck.
In the code below i'd like to append the page template - page title between the <title> tags dynamically rather than having to manually add to each page
<script language='JavaScript1.1' type='text/javascript'> <noscript> <img src="http://domain/xxx/xxx/s?websitename.PAGETITLE" width="1" height="1" alt=""> </noscript> </script>
Please rephrase your posting. It's not easy to understand what your real problem is (using TALES within the <script> tag?). -aj
Hi Andreas, Thanks, will try basically if i have some zpt pages with the tiltle <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. dean On 24 Apr 2007, at 15:16, Andreas Jung wrote: --On 24. April 2007 15:05:49 +0100 Dean Hale <dean.hale@sunderland.ac.uk> wrote:
Hi
I'm trying to implement some web tracking code within a page template, however a little stuck.
In the code below i'd like to append the page template - page title between the <title> tags dynamically rather than having to manually add to each page
<script language='JavaScript1.1' type='text/javascript'> <noscript> <img src="http://domain/xxx/xxx/s?websitename.PAGETITLE" width="1" height="1" alt=""> </noscript> </script>
Please rephrase your posting. It's not easy to understand what your real problem is (using TALES within the <script> tag?). -aj
--On 24. April 2007 15:25:24 +0100 Dean Hale <dean.hale@sunderland.ac.uk> wrote:
Hi Andreas,
Thanks, will try
basically if i have some zpt pages with the tiltle
<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. -aj
Hi Andreas, Thanks - i know the title does not belong in a script tag, i just want the text within the title tag appended within the javascript, not the tags themselves. Sorry its my explanations for help that are unclear. thanks dan On 24 Apr 2007, at 15:35, Andreas Jung wrote: --On 24. April 2007 15:25:24 +0100 Dean Hale <dean.hale@sunderland.ac.uk> wrote:
Hi Andreas,
Thanks, will try
basically if i have some zpt pages with the tiltle
<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. -aj
--On 24. April 2007 15:40:22 +0100 Dean Hale <dean.hale@sunderland.ac.uk> wrote:
Hi Andreas,
Thanks - i know the title does not belong in a script tag, i just want the text within the title tag appended within the javascript, not the tags themselves. Sorry its my explanations for help that are unclear.
thanks dan
Move your code to generate the HTML snippet into a script and generate whatever you need on the Python level. If you generate the <title> using TALES, you can use the same API in Python to generate the title inside your <script> code. Then call the script from the template. -ajh
Hi Andreas,
Thanks - i know the title does not belong in a script tag, i just want the text within the title tag appended within the javascript, not the tags themselves. Sorry its my explanations for help that are unclear.
I'm not sure if I understand you but... Where <title> tag content came from? If this is from typical title_or_id function then you may use something like: <title tal:content="here/title_or_id"></title> you may then also do: <img tal:attributes="src python: 'http://domain/xxx/xxx/s?websitename.%s' % (here.title_or_id())" width="1" height="1" alt=""> -- Maciej Wisniowski
Andreas Jung wrote:
--On 24. April 2007 15:25:24 +0100 Dean Hale <dean.hale@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
--On 24. April 2007 09:56:41 -0500 Jeff Rush <jeff@taupro.com> wrote:
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>
As far as I can recall: you can't use TALES within a SCRIPT block. That's why you must generate your stuff outside inside a script. -aj
Andreas Jung wrote:
As far as I can recall: you can't use TALES within a SCRIPT block. That's why you must generate your stuff outside inside a script.
Ah thanks I wasn't aware of that exclusion, never having tried it or found it documented. Then yes your approach is the only one left. -Jeff
--On 25. April 2007 00:41:19 -0500 Jeff Rush <jeff@taupro.com> wrote:
Andreas Jung wrote:
As far as I can recall: you can't use TALES within a SCRIPT block. That's why you must generate your stuff outside inside a script.
Ah thanks I wasn't aware of that exclusion, never having tried it or found it documented. Then yes your approach is the only one left.
The reason is obvious: Usually you don't have any markup with <script>..</script>. Still not getting why generate <img> within a <script> tag...appears like broken-by-design to me...but I don't care. -aj
It escapes the characters inside the SCRIPT block before processing, why is why you can't do any TALES or anything else really in there... On 4/24/07, Andreas Jung <lists@zopyx.com> wrote:
--On 25. April 2007 00:41:19 -0500 Jeff Rush <jeff@taupro.com> wrote:
Andreas Jung wrote:
As far as I can recall: you can't use TALES within a SCRIPT block. That's why you must generate your stuff outside inside a script.
Ah thanks I wasn't aware of that exclusion, never having tried it or found it documented. Then yes your approach is the only one left.
The reason is obvious: Usually you don't have any markup with <script>..</script>. Still not getting why generate <img> within a <script> tag...appears like broken-by-design to me...but I don't care.
-aj _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Thanks, Derek Wilson
Hello all, Thanks very much for all of your help. thanks dean On 24 Apr 2007, at 16:20, Andreas Jung wrote: --On 24. April 2007 09:56:41 -0500 Jeff Rush <jeff@taupro.com> wrote:
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>
As far as I can recall: you can't use TALES within a SCRIPT block. That's why you must generate your stuff outside inside a script. -aj
Hi Dean, Dean Hale wrote:
I'm trying to implement some web tracking code within a page template, however a little stuck.
In the code below i'd like to append the page template - page title between the <title> tags dynamically rather than having to manually add to each page
<script language='JavaScript1.1' type='text/javascript'> <noscript> <img src="http://domain/xxx/xxx/s?websitename.PAGETITLE" width="1" height="1" alt=""> </noscript> </script>
do you have any advise please on how this could be done?
I've re-read this thread about four times now, and am having a lightbulb moment. Do you mean that you wish to dynamically form the tag: - <img src="http://domain/xxx/xxx/s?websitename.PAGETITLE" width="1" height="1" alt=""> ...such that "PAGETITLE" is the title of the current page? If so, you need to bone up on "tal:attributes", because you need to do something like: - <img tal:attributes="src string:http://url?sitename.${here/title_or_id}" src="http://domain/xxx/xxx/s?websitename.PAGETITLE" width="1" height="1" alt=""> (Untested - but you get the idea) HTH -- Regards, PhilK
participants (6)
-
Andreas Jung -
Dean Hale -
Jeff Rush -
Maciej Wisniowski -
Philip Kilner -
SpiderX