Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Detailed Pages

Quote Reply
Detailed Pages
I'm wordering if it's possible - or better: a mod - to have detailed pages in different templates-styles. So for example: detailed music-reviews look different then book-reviews.

- Chris

And I'm still looking for the review.cgi mod. (widgetz.com/review2 is not the location anymore.)

Quote Reply
Re: Detailed Pages In reply to
You will need to the following:

1) Copy the following variables in the Links.pm file:

Code:

$LINKS{build_detail_path} = "$LINKS{build_root_path}/Detailed";
$LINKS{build_detail_url} = "$LINKS{build_root_url}/Detailed";


and rename the Detailed to something else like Book_Reviews. And also replace the variable names with something like:

Code:

$LINKS{build_bookreview_path}
$LINKS{build_bookreview_url}


2) Copy the sub build_detailed_view routine in the nph-build.cgi and rename the new subroutines something like sub build_bookreviews_view. In these new subroutines, replace the following variables:

Code:

$LINKS{build_detail_path}
$LINKS{build_detail_url}
[/red]

with the following variables:

Code:

$LINKS{build_bookreviews_path}
$LINKS{build_bookreviews_url}


3) Create the directores you are calling in the links/pages directory and change their permission to 777 (drwxrwxrwx).

Example:

links/pages/Book_Reviews

4) Re-build your directory.

OR if you want to use dynamic detailed pages via the detail.cgi Mod located in the Resource Center, you could simply do the following:

1) In the sub site_html_detailed routine in the HTML_Templates.pm file, add the following conditional statements:

Code:

if ($in->param('tmp') eq '1') {
$template = "bookreviews.html";
}
elsif ($in->param('tmp') eq '2') {
$template = "musicreviews.html";
}
else {
$template = "detailed.html";
}


2) Then replace the following codes in that sub:

Code:

my $output = &load_template ('link_detail.html', {


with the following codes:

Code:

my $output = &load_template ($template, {


3) Then to call the appropriate detailed template, use the following link codes in your link.html file:

Code:

<a href="<%build_detail_url%>?ID=<%ID%>&tmp=1">Book Reviews</a>
<a href="<%build_detail_url%>?ID=<%ID%>&tmp=2">Book Reviews</a>


Of course, you may have to add another field in your Links table that specifies whether the link is a book or music (via ENUM field type).

Then you could add the following codes in your link.html file:

Code:

<%if Type eq 'Book'%>
<a href="<%build_detail_url%>?ID=<%ID%>&tmp=1">Book Review</a>
<%endif%>
<%if Type eq 'Music'%>
<a href="<%build_detail_url%>?ID=<%ID%>&tmp=2">Music Review</a>
<%endif%>


Regards,

Eliot Lee
Quote Reply
Re: Detailed Pages In reply to
But if I would build mulitple detailed pages in different styles, that means I will build ALL pages in ALL styles. But due to the correct linking the user would be redirected to the correct layout. Or do ment something else?

(I rather not use page.cgi!)


Quote Reply
Re: Detailed Pages In reply to
And the codes I gave you WILL do that!

Regards,

Eliot Lee
Quote Reply
Re: Detailed Pages In reply to
That I was afraid of!

I rather have every page directly in the correct layout (and only once). So isn't the following possible: Put in the detailed template something like:

If category_name containts "Music" print ...... else if catergory_name containts "Movies" print ........else .....

Quote Reply
Re: Detailed Pages In reply to
Use the second option that uses a different template file based on a field like category!

Regards,

Eliot Lee
Quote Reply
Re: Detailed Pages In reply to
Hi Chris,

I am not a pro in these things but I think one easy way to
do exactly what you want to do is the following:
Like AnthroRules suggested add one field where you define whether your product is a book or whatever and then edit your detail.html that you have the regular header and then
<%if group eq 'book'%>
here you have your style for books
<%endif%>
<%if group eq 'something_else'%>
here you have your style for something_else
<%endif%>
and so on.
I am not sure if the eq is correctly but it is possible
somehow like that.

Niko

http://www.master-productions.com
Quote Reply
Re: Detailed Pages In reply to
I've been laid out with back pain and a double whammy, but what about doing something really, really "odd".

Make your detailed.html just be a line <%include cat_template%>

Where "cat_template" is a field in the Category table record. The "real" page would be there. use an <%if%> so that if there was no defined template, the default was used.

You could use the category_id, but that would look for a different template in EVERY directory and subdirectory, and depending on how big your system was, that could be a large project, though you could use MySQLMan or SQL to change that field using something like

UPDATE table SET cat_det_templ = 'some template' WHERE Name RLIKE '^TOPLEVEL'

Following? Any new field you add you need to add to the $OUT{} hash in nph-build.cgi.

This is a _minor_ sideways view of the multiple_template_mod posted for categories, where you are trying to use the detailed page, rather than the category template.

Make sense? Seems there is a lot of chatter going back and forth, and maybe the 'hacker' types (including me) are not understanding the question you are asking. I've also posted a detailed.cgi a month ago that will generate dynamic detailed pages, and you could pass it the category_ID as well as the ID parameter, and have it select a template based on that dynamically.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ