Gossamer Forum
Home : Products : Gossamer Links : Discussions :

[Suggestion] Template path change for file includes

Quote Reply
[Suggestion] Template path change for file includes
Alex & GT staff,

Currently Template path used in GT::Template to include a file, is relative to the template dir:
Quote:
must be in the template's root directory which is defined using $obj->root, or '.' by default.
I suggest you to make possible to use both absolute & relative paths in file includes.

1) Relative path to template directory (currently used)
__a) The relative include tag looks like following: <%include test.html%>
__b) The file is loaded from path relative to the template directory:
/cgi-bin/gforum/admin/templates/


2) Absolute path relative to the website root (my suggestion)
__a) Include tag using Absolute path should look like following:
_____1st example: <%include /cgi-bin/lsql/admin/test.html%>
(So if we use this tag in E.g: Gforum, it would be possible to use the same template even in Links SQL...)
_____2nd example: <%include /mytemplates/test.html%>
(this solution could make possible for us to use a central template repository for the whole site)
__b) So the file is loaded from path absolute from to the website root:
In 1st example the the file is included from path: /cgi-bin/gforum/admin/templates/
In 2nd example the the file is included from path: /mytemplates/

The logic to distinguish relative and absolute paths:
- if our file name starts with / sign, then we use absolute path to load the file
- else our file name is not starting with / sign, so we use relative path to template root to load the file

There are many advantages of this solution, we could even create sitewide template solutions. I think it would be a very easy & quick modification, so does not need too much work.
I'm very exited, when will this feature implemented.

Alex, I already used this kind of solution successfully, altough not in LSQL, yet.
I think, I could do the change, but I don't want to do any changes in main LSQL module codes, to maintain my LSQL compatibility.
Let me know, what do you think about suggestion, and if you want to implement it or not.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Subject Author Views Date
Thread [Suggestion] Template path change for file includes webmaster33 3785 Apr 29, 2002, 11:46 AM
Thread Re: [webmaster33] [Suggestion] Template path change for file includes
webmaster33 3669 May 7, 2002, 2:08 AM
Thread Re: [webmaster33] [Suggestion] Template path change for file includes
ridesworld 3615 May 7, 2002, 1:42 PM
Post Re: [ridesworld] [Suggestion] Template path change for file includes
Paul 3621 May 7, 2002, 1:47 PM
Thread Re: [ridesworld] [Suggestion] Template path change for file includes
webmaster33 3615 May 8, 2002, 3:25 AM
Thread Re: [webmaster33] [Suggestion] Template path change for file includes
Paul 3596 May 8, 2002, 3:34 AM
Thread Re: [Paul] [Suggestion] Template path change for file includes
webmaster33 3625 May 8, 2002, 4:03 AM
Thread Re: [webmaster33] [Suggestion] Template path change for file includes
webmaster33 3581 May 14, 2002, 2:22 AM
Post Re: [webmaster33] [Suggestion] Template path change for file includes
webmaster33 3549 May 27, 2002, 10:29 AM