Hi!
I was trying to extend the Dokubook template to include a discussion page. My approach was to just add another tab to the top of the page (where the Edit This Page tab is also located). That tab would just build a link using DOKU_BASE."talk/".$ID and thus create a page under the talk folder. This works fine.
When I'm on one of those discussion pages I don't won't to display the "Discussion" tab, since it would create discussions of the discussion. ;-)
The original main.php part of that template looks like this:
<ul id="top__nav">
<?php
foreach(array('edit', 'history', 'subscribe', 'subscribens') as $act) {
ob_start();
print '<li>' . DOKU_LF;
if(tpl_actionlink($act)) {
print '</li>' . DOKU_LF;
ob_end_flush();
} else {
ob_end_clean();
}
}
?>
</ul>
This is what I added before the </ul>:
<?php
$this_page_id = str_replace(":","/",$ID);
$check_talk = strpos($this_page_id,"talk");
if($check_talk == false) {
?>
<li><a href="<?php echo DOKU_BASE ."talk/".$this_page_id ?>" class="action">Discussion</a></li>
<?php
}
?>
This should only display the "Discussion" link if the $ID doesn't contain "talk". However this always results in false for some unknown reason, even if I'm on a page in the talk/pagename structure. If I just do a strpos on "alk" instead of "talk" it works for some reason and correctly returns a true on talk directory pages and thus doesn't show the "Discussion" link.
I also tested the exact same code snipped (filling the $this_page_id variable with some made-up string, of course) outside of Dokuwiki and it works on as many characters as I want - why doesn't this code work within the Dokuwiki template?
Any thoughts? This is a basic Dokuwiki (current version) install without any Plugins on PHP 5.2.6.
Jan