[Pmwiki-users] new user

Jonathan Scott Duff duff
Wed Nov 3 15:35:50 CST 2004


On Wed, Nov 03, 2004 at 04:14:25PM -0500, Jesse Grosjean wrote:
> After a week of trying out many different wiki software packages I've 
> finally settled on pmwiki. Thanks it looks like great software. I've 
> decided to use the 2.0 branch for my project and have a few questions.

Excellent choice!  ;-)

> First I've successfully created my own skin with a .tmpl file. But now 
> I want to include some boiler plate text in that template file by 
> including some other files on my website. For example I would like to 
> put the equivalent of this line:
> 
> 	<?php
> 	include("../includes/footer.html");
> 	?>	
> 
> in my wiki .tmpl file. I've been trying to use the
> 
> 	Call a PHP function <!--function:SomeFunction ''arguments''-->
> 
> syntax, but I can't quite get it right. Can someone let me know what 
> the best way to include other files in a .tmpl file is? 

Add <!--function:RawInclude path/to/file.html--> to your template and
make sure that you have RawInclude() defined in your config.php.
Here's a quick example:

	function RawInclude($pagename,$filename) {
  	   readfile($filename);
	}   

It's important to note that pmwiki passes the pagename as the first
parameter to any function used in the <!--function:--> syntax.

***BUT***

you really should just be using the <!--file:--> syntax:

<!--file:path/to/file.html-->

however, when I just tried it using pmwiki-2.0.devel21 it didn't work
at all.

> I understand 
> that pmwiki has some footer variables and maybe i should be using them. 
> But the footer file that I wish to include is site-wide (not just in 
> pmwiki) and I don't know how to load that text into a pm variable.

Perhaps.  But I think your approach works just fine too.

> Second I'm looking at the http://www.pmwiki.org/wiki/Cookbook/X-Gallery 
> image gallery cookbook project from pmwiki 1.0. Does anyone have this 
> working for pmwiki 2.0? Or is there any image gallery software in 
> progress for pmwiki 2.0 that I could look at? I've tried to get 
> x-gallery working with 2.0, but I can't get past this line:
> 
> 	$DoubleBrackets["/\\[\\[x-gallery:(.*?)\\]\\]/e"] = 
> 	'xGallery("$1");';
> 
> I think this needs to be changed to use the pmwiki 2.0 Markup() 
> function, but I'm not sure how to get the syntax right.

I *think* it would be something like this:

	Markup(
	   'gallery',			# an id for this markup
	   'directives',		# when this gets executed
	   '/\\(:gallery (.*?):\\)/e',	# the RE itself
	   'xGallery("$1")',		# the replacement
	);

See http://www.pmichaud.com/pmwiki2/pmwiki.php/PmWiki/CustomMarkup for
more information.

-Scott
-- 
Jonathan Scott Duff
duff at pobox.com



More information about the pmwiki-users mailing list