Go to the FreeLists Home Page Home Signup Help Login
 



[dokuwiki] || [Date Prev] [09-2007 Date Index] [Date Next] || [Thread Prev] [09-2007 Thread Index] [Thread Next]

[dokuwiki] Re: page id from javascript

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 14 Sep 2007 04:37:05 +0100
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.
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.