Gossamer Forum
Quote Reply
Template Sets
Alex,

I might be missing something, but is there a way to set up different template sets when you call Site::HTML::display?

For instance, it would be nice if a plugin could install it's templates in it's own directory, so those templates could be used by all versions or formats of the program, without having to maintain duplicate sets for each main template set. The plugin would call the "default" template set for itself, unless that option was turned off in the admin.

I thought there was a way to do it, but I'm doing something wrong ??

This would allow people who use multilingual templates to put the templates in each language directory, but would allow someone like me, who only has the ability to maintain English sites (barely<G>) to have one template directory for the plugin that could be shared by all the "styles".

If nothing else, than for development or housekeeping reasons :) Something about putting all the templates for all programs into the same directory bothers me -- the way Windows puts all it's stuff together. It makes housekeeping a lot harder, and it's more difficult for a user to determine what templates were installed by what program.

Even using a prefix only helps partly, because all the "system" templates don't. That means plugin templates would be grouped in and around the system templates, so finding all the "basic" or "default" templates would still be prone to errors.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Template Sets In reply to
Hi,

With 2.1.0, yes. There was a bug in 2.0.5 that prevented it from working properly. Basically you call:

Links::SiteHTML::display ( 'template', { vars }, { options });

where options can contain:

t => template_set to use
compress => 0/1 to compress output

You can also use Links::user_page ('template', { vars }, { opts }), and probably should unless you need some of the special things SiteHTML does (for links, and subcategories primairly).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Template Sets In reply to
Ok...

Is this a logic/stylistic thing where:

Links::user_page ('template', { vars }, { opts });

is the way to call most templates?

Links::SiteHTML::display ( 'template', { vars }, { options });

does a check for certain templates, which does additional processing -- such as link.html where the various flags are set.

Links::user_page would probably have a lower overhead, since it's the end result of the call to Links::SiteHTML::display anyway. This does create some interesting nesting issues.

For instance, I'm assuming that the template parser, when it hits an <%include%> calls Site::HTML::display, to pick up the included links.html files, etc.

The only problem I see here, is if this calling convention changes, this display routine has been hard coded into the scripts, from the main Links library. I can see further development taking it to:

Links::UserPage::display

It seems that this is an area of the program that is still developing.

An off the wall idea/comment:

Since Links::SiteHTML is where the specialized display routines go, what about extending this so that users/authors/plugins can insert specialized display routines to this tree? If a subdirectory was created "UserDisplay", into which an author could place code fragments which consist of a named subroutine to be required into the code prior to a call to the autoload function. It would override the autoloaded function, and it would allow an extensible, survivable method of providing specialized output routines at the expense of a directory call.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.