Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Switching Templates

Quote Reply
Switching Templates
Heya,

I know I can load a new template set by adding "&t=template_set_name" to the URL. How can I reload a page, regardless of where I am and how deep I've drilled into the categories or link pages with a new template set.

I want to have an option to "Display Titles Only" or "Display Full Links" at the top of my link pages. I default to showing headlines only, 25 at a time, but would like to be able to display the the same 25 links in a more detailed format on the same page at any time.

I guess I'm trying to figure out how to dynamically reference the "g=" variable at the end of the URL. So, if I want to swith to a template set called "full_view" on any page, what would the g= on the link below look like on the template?

<A HREF="<%db_cgi_url%>/page.cgi?g=what_goes_here&t=full_view">

Safe swoops
Sangiro

Last edited by:

sangiro: Apr 5, 2003, 3:14 PM
Quote Reply
Re: [sangiro] Switching Templates In reply to
Just a few ideas.

1) The easiest way is to solve it by using 2 template sets. Forget the 'g' parameter, it's the category. You need to use the 't' parameter.
1st template displays short links with title:
<A HREF="<%db_cgi_url%>/page.cgi?g=Computers/Accessories/index.html&t=title_only">

2nd template displays long links with full details:
<A HREF="<%db_cgi_url%>/page.cgi?g=Computers/Accessories/index.html&t=full_view">

2) Also however I never used detailed pages, Detailed feature may be also used for such task.

3) Furthermore a plugin or global can be also developed for such task.

Hope this helps.

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...
Quote Reply
Re: [webmaster33] Switching Templates In reply to
I plan to use 2 template sets. My question is how write a link so the "Computers/Accessories/index.html" part of your URL is generated automatically depending on which page you're on. If you go to page 2 of that category the last part of the URL will change to Computers/Accessories/more2.html.

I want to be able to switch to the new template set from any page and still be on that page in the new template set. For that reason I don't think I can ignore the g= parameter. I need to use both that and t=.

Safe swoops
Sangiro

Last edited by:

sangiro: Apr 5, 2003, 6:32 PM
Quote Reply
Re: [sangiro] Switching Templates In reply to
There is possibly better solution, but I'm just arrived home from a Saturday party Wink hiccup Angelic

We assume, you are on a category page, where the 'g' parameter was filled automatically in URL.
So with following global (named category_input) you can get value of 'g' parameter:
Code:
sub {
return $IN->param('g');
}

And in template use this:
<A HREF="<%db_cgi_url%>/page.cgi?g=<%category_input%>&t=title_only">


If I would do a <%GT::Template::dump%>, I'm sure I would quickly give you a better solution.
Try <%GT::Template::dump%>, you may get the idea.

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...

Last edited by:

webmaster33: Apr 5, 2003, 7:15 PM
Quote Reply
Re: [webmaster33] Switching Templates In reply to
Did a dump (don't know why I didn't do that before! Blush) and it turns out the g variable is already defined. So, you can simply use:

<A HREF="<%db_cgi_url%>/page.cgi?g=<%g%>&t=title_only">

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Switching Templates In reply to
Exactly. That's the best solution to use the <%g%> tag.
Glad it helped.

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...