[Pmwiki-users] getting the template path?

Thomas -Balu- Walter list+pmwiki-users
Tue Feb 24 16:32:52 CST 2004


On Tue, Feb 24, 2004 at 03:37:49PM -0700, Patrick R. Michaud wrote:
> On Tue, Feb 24, 2004 at 11:12:59PM +0100, Thomas -Balu- Walter wrote:
> > 
> > I am not sure wether we need variables for those two, but having a
> > variable that points to the actual skin directory helped here. I've
> > done the following now:
> > 
> > in local/config.php:
> > $PageTemplateFmt  = 'pub/skins/balu/page.tmpl';
> > $PageTemplatePath = dirname($PageTemplateFmt);
> 
> Oh, this is pretty good.  Maybe tlayout.php should automatically
> set a value for $PageTemplateDir based on the value of $PageTemplatePath?

I just noted that I expected the template to be directly in a subfolder of
the skins dir. If one creates a really complicated template and has
subdirs in pub/skins/balu like 

        pub/skins/balu/tmpl/page.tmpl
        pub/skins/balu/css/ 
        pub/skins/balu/images/ 

$PageTemplatePath would be pub/skins/balu/tmpl/ which is wrong.

Ideas:
- define, that $PageTemplateFmt has to be relative and the filename has
  to be in the first skin-directory level (bad IMHO)
- just specify a $Skin and create $PageTemplate* using this setting (see
  below)
- other?

> And it'd be really nice if we could also set a $PageTemplateDirUrl also,
> for references to images and css files.  But I'm not quite sure of a
> robust way to achieve this last one...

Hm. 
For idea 1:
$PageTemplateFmt    = 'pub/skins/balu/page.tmpl';
$PageTemplatePath   = dirname($PageTemplateFmt);
$PageTemplateDir    = basename($PageTemplatePath);
$PageTemplateDirUrl = preg_replace("#/[^/]*\$#","/pub/skins/".$PageTemplateDir,$ScriptUrl,1);

If idea 2 is preferred:
$Skin               = 'balu';
$PageTemplateDir    = 'pub/skins/'.$Skin; 
$PageTemplateDirUrl = preg_replace("#/[^/]*\$#",$PageTemplateDir,$ScriptUrl,1);
$PageTemplateFmt    = $PageTemplateDir.'/page.tmpl'; // default filenames?

It's getting late here, so I might be to tired to think about this in
total :)

> > $AuthorGroup was what I was missing. This won't work though if
> > $LastModifiedBy contains spaces and similar...
> 
> Oh, you're right.  Perhaps I should also set a $LastModifiedByPage
> that has the profile page of the person that last edited the page
> (i.e., that strips the spaces and stuff, same as is done for $AuthorPage
> in scripts/author.php)?

Not sure if this would help, since just using $LastModifiedByPage in the
template file would not create a link to the profile itself, but just
display it as text. I can not use WikiWords and similar inside the template
files as they seem not to get parsed?

Perhaps this and a <!--function: --> would be enough, but I don't know
the internal functions to choose the right one.

     Balu



More information about the pmwiki-users mailing list