[Pmwiki-users] Suggestions for Template Improvements

Steven Leite steven_leite
Thu Feb 26 10:12:05 CST 2004


> >    Suppose I'm making a new Group template called:
> >    "MyNewGroup.tmpl".
> >    * Problem 1 *
> >    My  wysiwyg  editor won't load the .tmpl file unless I explicitly
tell
> >    it  to  do  so  because  it  doesn't  recognize .tmpl as a valid
.html
> >    extension.
>
> So, name your new template "MyNewGroup.htm".  PmWiki doesn't care at all
> what the template files are named.
>

Yes, ok fine, but that defeats the point of making things easy.  What point
is there to create a file suffix like .tmpl which doesn't play nice with
html editors, not to mention it's not recognized by experience html
programmers as an editable html file?  I thought the whole point of
switching to a new template system was to make things easier?  Anyways,
that's a very minor detail, as you said, you can make MyTemplate.xyz if you
want, PmWiki doesn't care anyways.  This point does gain more weight when
you consider it a part of problem two however ...



> >    * Problem 2 *
> >    Currently  (as  of  the  6.4  release?) PmWiki checks for existance
of
> >    GroupName.css  and  automatically  includes  them  in  the html
output
> >    (which  is  great!), but  suppose  an html author creates a spiffy
new
> >    template, and aptly names it:
> >    /pub/skins/MyNewGroup/MyNewGroup.htm
> >    as well as a file called
> >    /pub/skins/MyNewGroup/MyNewGroup.css.
> >
> >    Currently,   PmWiki will  be  looking  in  the  wrong  place  for
the
> >    MyNewGroup.css  file .

> Not at all.  If your template is a per-group template and the .css file
> was designed jointly with the template, then I think your template should
> have  <link rel='stylesheet' href='pub/skins/MyNewGroup/MyNewGroup.css'
... />
> coded in it.  Most wysiwyg editors will include the <link...> elements
> in the template anyway.

Which will promptly break when uploaded to the server unless the path on
your local system matches the path on the server system.  I like the idea of
being able to put a .css file inside the same directory as my template file
and have pm wiki automatically insert the link to the style sheet for me.

> Just because PmWiki has a per-group .css feature doesn't mean you're
> required to use it for all of your .css files.  The per-group .css
> feature is really meant for sites that are using a shared template file
> for many groups but need a simple way to add group-specific stylesheet
> customization, which is different from the scenario you pose here of
having
> a separate template for each group.

I was thinking the MyGroup.css file would be "in addition to" any default
.css files that were previously defined.  Is that incorrect?

Likewise, I assume any MyGroup/MyPage.css files would be in addition to any
default.css files, and any MyGroup.css files that might have been previously
defined.  Is that correct?

> >    Also,  there's currently no way to make the
> >    new  template  work  without taking  further  (confusing) steps;
those
> >    being   that the html  author  must  create  yet  another  file
called
> >    MyNewGroup.php, and put it in yet another directory called /local.
If
> >    that  wasn't  bad  enough,  he/she also has to edit the
MyNewGroup.php
> >    file  and  instruct PmWiki precisely where to find the new template
by
> >    specifying something wierd programming code like:
> >    $PageTemplateFmt = 'pub/skins/MyNewGroup/MyNewGroup.htm';
>
> False.  You can set $PageTemplateFmt='pub/skins/$Group/$Group.htm' in
> config.php if you want per-group templates, no local/MyNewGroup.php is
> required.

This is too confusing.  I suggest leaving php codes to coders, and not
requiring or expecting new users to learn this syntax unless it's really
necessary.  I know, it's a weak point, it's not exactly rocket science,
still, it's a heck-of-a-lot easier to not have to type anything at all and
just have it work.

Creating or modifying a /local/config.php for each and every template you
create is going to get darn annoying (unless you are fortunate enough to
have read this post and see that nifty piece of code up there).  Having
PmWiki check if $Group/$Group.htm and $Group/$Group.css exists is much
simpler and easier for the user.  I know you'll see it may way eventually
;-)  <grin>

> >    * Solution 2 *
> >    PmWiki  should  automatically  check  the  /pub/skins  directory for
a
> >    folder   called   MyNewGroup,   containing   a  template  file
called
> >    MyNewGroup.htm, and additionally, a css file called MyNewGroup.css.
>
> Veto, at least for the moment.  I've already come to the conclusion that
> having PmWiki do too many things "automatically behind the scenes" in the
> distribution, and it becomes more difficult to document.  See my comments
in
> the last paragraphs of
http://pmichaud.com/pipermail/pmwiki-users_pmichaud.com/2004-February/003226.html.

Fair enough.  Can't argue with a veto, heheh.

> Finally, it is fairly simple to implement a short cookbook recipe that
> can go in config.php and does exactly what you've described above:
>
>    SDV($PageCSSListFmt,array(
>      'pub/skins/$Group/$Group.css' => '$PubDir/skins/$Group/$Group.css'));
>    $tmpl = FmtPageName('pub/skins/$Group/$Group.htm',$pagename);
>    if (file_exists($tmpl)) $PageTemplateFmt = $tmpl;

My great disappointment has been aleviated by this sweet code.  I created a
file called easytempaltes.php, and included the code exactly as above
(between the <php and ?> braces of course.  Then in my config.php, I added
the line:  include_once("easytemplates.php");  And as you said, it does
exactly what I described.  Thanks.  I guarantee many people will find this
useful (if they ever discover this post).

Only one thing, the CSS part doesn't seem work quite right.  I'll play with
it a bit more, maybe it's just a little glitch I can fix on my own, but can
you check your code snippet above and confirm it?  Otherwise, it works
GREAT!

<10 minutes later> ... It seems to be a problem with pmwiki core.  The
<!--HeaderText--> introduced in 0.6.3 doesn't seem to be working quite
right.  It's getting inserted in to my html output, but it's not rendering
the $PubDir properly.
Small Bug?  / Glitch?  I'd look for and fix the bug myself, but by the time
I find it, you'll have it fixed and re-release as a new version, so I'll
just check back in a few hours and download the new version (LoL)

THANKS AGAIN

--S




More information about the pmwiki-users mailing list