[dokuwiki] Re: only page name (not the whole path) -> maybe plugin???

  • From: Koen Huybrechts <huybkoen@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 05 Oct 2005 18:27:06 +0200

Chris Smith wrote:


hi,

so it should be something like this:

main.php:

<div class="print_only">
<?php
$string = "$ID";
$string = str_replace("[","",$string);
$string = str_replace("]","",$string);
$string = explode(":",$string);
$laatste = end($string);
echo "$laatste";
?>
</div>

layout.css:

.print_only {display:none;}

(I assume $ID is the path of the page?? or not?)

This should work you think??

koko

$ID is the namespace+page name. It doesn't have any "[" or "]" if you just want the page and not the name space, then use noNS($ID).

e.g.

<?php echo noNS($ID)?>

to be safe you should probably filter the output through hsc() to ensure any html special characters are converted to entities. Its not really necessary as a dokuwiki ID is may not contain any special charaters,but if that were to change you would be safe using ...

<?php echo hsc(noNS($ID))?>

Chris





hi,

Thanks a lot, I got it working... Never thought it would be so easy!! Now I can print my work for school right from the wiki :-P

Would it be usefull to make a plugin of it, or not??

koko

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: