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

  • From: Koen Huybrechts <huybkoen@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 05 Oct 2005 16:55:10 +0200

Chris Smith wrote:

Koen Huybrechts wrote:

Koen Huybrechts wrote:

hi,

A while ago, I asked for a little bit of code to print the page title at the beginning of page (when printing). I got some code that prints the whole path of the page (so for example [[school:2:bio:2daagse:Vijverbiotoopstudie]]). Until now I it was good enough, but now, I would like to delete the [ (what do you call it in English?) and the whole path, except the last part of it. I think I can get this coded, but I have no idea where to put it, so can anyone tell me where I should put this little part of code?? (Maybe I can make a plugin of it, but how should I do that??) Would this be a good idea???

Thanks,

koko

hi,

I forgot the code (it isn't high-tech, but I think it works...)

<?php
$string = "[[school:2:bio:2daagse:Vijverbiotoopstudie]]";
$string = str_replace("[","",$string);
$string = str_replace("]","",$string);
$string = explode(":",$string);
$laatste = end($string);
echo "$laatste";
?>

Where should I put this in the wiki, or how can I make a plugin of it?? Which option would you prefer (plugin, or in code)??

koko

Hi Koko,

You should be able to add something like this in your template ...

in main.php add this line or similar after the <body>

<div class="print_only"><?php echo $ID?></div>

and then style it appropriately.

in layout.css add #print_only {display:none;}
in print.css nothing is required, should print in default style, you can add styles to have it print how you like.


Cheers,

Chris

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


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

Other related posts: