[dokuwiki] Re: page id from javascript
- From: Myron Turner <turnermm02@xxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 14 Sep 2007 07:42:56 -0500
Chris Smith wrote:
Martin Tschofen wrote:
That's what I'm doing now, but I was hoping it would be already
available in
the existing code...martin
I don't think its currently included in DW. If you have javascript
which requires the value and you don't wish to update the template,
that implies you are supplying custom JS to DW via a plugin.
Following on from that you have a couple of alternatives ...
1. Use an action plugin to add "<script type=\"text/javascript\"> var
ID = $ID; </script>" or "<input id=\"dw_page_id\" type=\"hidden\"
value=\"$ID\" />" string via one of the output events,
TPL_CONTENT_DISPLAY, TPL_ACT_RENDER & TPL_METAHEADER_OUTPUT(*).
2. Use an action plugin to add the data to a cookie.
I think TPL_METAHEADER_OUTPUT & <script> string is probably best.
-- Chris
(*) Its conceivable, though probably quite unlikely, that a template
will not call tpl_metaheaders() which would prevent
TPL_METAHEADER_OUTPUT event from firing.
Is there a reason why one of the above is preferable to embedding this
<script> var ID = "<?php echo $ID; ?>"; </script>
in main.php? This seems the simplest way, but there may be reasons why
it's not recommended.
Thanks,
Myron
--
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: page id from javascript
- From: Ilya S. Lebedev
- [dokuwiki] Re: page id from javascript
- From: Chris Smith
- References:
- [dokuwiki] page id from javascript
- From: Martin Tschofen
- [dokuwiki] Re: page id from javascript
- From: Myron Turner
- [dokuwiki] Re: page id from javascript
- From: Martin Tschofen
- [dokuwiki] Re: page id from javascript
- From: Chris Smith
Other related posts:
- » [dokuwiki] page id from javascript
- » [dokuwiki] Re: page id from javascript
- » [dokuwiki] Re: page id from javascript
- » [dokuwiki] Re: page id from javascript
- » [dokuwiki] Re: page id from javascript
- » [dokuwiki] Re: page id from javascript
- » [dokuwiki] Re: page id from javascript
- » [dokuwiki] Re: page id from javascript
Martin Tschofen wrote:
That's what I'm doing now, but I was hoping it would be already available inI don't think its currently included in DW. If you have javascript which requires the value and you don't wish to update the template, that implies you are supplying custom JS to DW via a plugin. Following on from that you have a couple of alternatives ...the existing code...martin
1. Use an action plugin to add "<script type=\"text/javascript\"> var ID = $ID; </script>" or "<input id=\"dw_page_id\" type=\"hidden\" value=\"$ID\" />" string via one of the output events, TPL_CONTENT_DISPLAY, TPL_ACT_RENDER & TPL_METAHEADER_OUTPUT(*).
2. Use an action plugin to add the data to a cookie. I think TPL_METAHEADER_OUTPUT & <script> string is probably best. -- Chris(*) Its conceivable, though probably quite unlikely, that a template will not call tpl_metaheaders() which would prevent TPL_METAHEADER_OUTPUT event from firing.
- [dokuwiki] Re: page id from javascript
- From: Ilya S. Lebedev
- [dokuwiki] Re: page id from javascript
- From: Chris Smith
- [dokuwiki] page id from javascript
- From: Martin Tschofen
- [dokuwiki] Re: page id from javascript
- From: Myron Turner
- [dokuwiki] Re: page id from javascript
- From: Martin Tschofen
- [dokuwiki] Re: page id from javascript
- From: Chris Smith