Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

different info on detailed page depending on FatherID

(Page 1 of 2)
> >
Quote Reply
different info on detailed page depending on FatherID
I want a different detailed-page for a certain FatherID.

The idea must be like this.

In the the detailed page:

<%if FatherID eq '3'%>
<%include test1.html%>
<%else%>
<%include test2.html%>
<%endif%>


I know this isn't right! How can I catch the Fatherid in the detailed page??

Thanks,
Ron
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Call this tag *before* your current stuff; (it won't output anything, just simply add the FeatherID tag)

Code:
sub {

my $ID = $_[0];
my $table = $DB->table('CatLinks');
my $sth = $table->select( { LinkID => $ID } ) || return "";

my $CatID;
while (my $hit = $sth->fetchrow_hashref) {
$CatID = $hit->{CategoryID};
}

$CatID ? return { FatherID => $CatID } : return '';

}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
Example of use;

<%global_name($ID)%>

<%if FatherID eq '3'%>
<%include test1.html%>
<%else%>
<%include test2.html%>
<%endif%>

The top global call will not return any output, but will simply assign the <%FatherID%> tag, which you can then use for your 'if' statements (shown above).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
Andy,

It comes every time with test2.html
I tried some combinations...

thanks,
ron
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Does FatherID hold a value if you do a <%GT::Template::dump%> ?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
Andy,

I see many variables, but no FatherId
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Is there a value for 'ID' ?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
Yes, there is an ID variable
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Try changing this;

$CatID ? return { FatherID => $CatID } : return '';

to this;

return { FatherID => $CatID };

Does it show anything for FatherID then?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
No Andy,

No errors, no FatherId
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Try changing;

my $sth = $table->select( { LinkID => $ID } ) || return "";

to;

my $sth = $table->select( { LinkID => $ID } ) or return $GT::SQL::error;

Whats that do?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
No Andy,

No FatherId and no errors...
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
You definatly passing the $ID to the global?

<%global_name($ID)%>

?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
Andy,

This I put in my detailed page..

-------------------------
<%GT::Template::dump%><br>
-------------------------
<%diff_detail($ID)%>

<%if FatherID eq '1345'%>
<%include test1.html%>
<%else%>
<%include test2.html%>
<%endif%>



**********************************
This is the global: diff_detail

sub {
my $ID = $_[0];
my $table = $DB->table('CatLinks');
my $sth = $table->select( { LinkID => $ID } ) or return $GT::SQL::error;
my $CatID;
while (my $hit = $sth->fetchrow_hashref) { $CatID = $hit->{CategoryID};
}
return { FatherID => $CatID };
}

**********************************
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Very odd. One last attempt...

Try changing;

my $ID = $_[0];

to;

my $ID = shift;

Does that do anything? If that doesn't work, I'm afraid I'm out of ideas.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
No Andy,

Still the same. I guess you are on the right track. I gonna try further.

Thanks for your time....
Wink
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Andy, I don't understand. FatherID comes from the Category table. I see in the global that you refer to the Catlinks table...
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
That CatLinks table holds the 'LinkID' and 'CategoryID'. It basically works as an intermediary between lsql_Links and lsql_Category.

If you open the CatLinks table via a 'select', it theoretically should give you the category ID of the link ($hit->{CategoryID}).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
Hello Andy,

It must be based on the fatherID in the Category-table.

example:
I have a category "animals". Beneath that is a subcategory "dogs" , and a subcategory "cats"

Animals has in table Category an ID 1345
cats and dogs have a FatherID with 1345 and NO id in catlinks.

So I think the global points to id 1345 as a maincategory in catlinks and not to the subcats beneath that.

And it must refer to all subcategories with fatherid 1345


Am I right for this?

Thanks,
Ron
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
You sure you know what you are asking for? The FatherID is the category ID that the category is assigned to. i.e;

1- Main
2- Main/Test
3- Main/Test/Again

Main/Test would have a FatherID of 1, whilst Main/Test/Again would have a FatherID of 2. You sure thats what you want?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
I am definitely sure Andy!.....
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
In that case, try this;

Code:
sub {

my $ID = $_[0];
my $table = $DB->table('CatLinks');
my $sth = $table->select( { LinkID => $ID } ) || return "Error: $GT::SQL::error";

my $CatID;
while (my $hit = $sth->fetchrow_hashref) {
$CatID = $hit->{CategoryID};
}

my $table = $DB->table('Category');
my $sth = $table->select( { ID => $CatID } ) || return "Error: $GT::SQL::error";

my $FatherID;
while (my $hit = $sth->fetchrow_hashref) {
$FatherID = $hit->{FatherID};
}


return { FatherID => $FatherID }

}

Call with;

<%global_name($ID)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different info on detailed page depending on FatherID In reply to
That did the job.

Great and many thanks Andy!!!

bye,
Ron
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
Andy,

I want to do the same trick with the add.html template. But that doesn't work. It comes only with form2.
Why does it works ok with detailed.html and not with add.html?


The template dump <%GT::Template::dump%> shows in detailed a fatherid and not in add.html!



I use the same global as in detailed with this logic below.

*******************************
<%diff_detail($ID)%>

<%if FatherID eq '1345'%>
<%include include_form1.html%>
<%else%>
<%include include_form2.html%>
<%endif%>
*******************************

Thanks,
Ron
Quote Reply
Re: [rsahertian] different info on detailed page depending on FatherID In reply to
The link ID cannot be assigned in add.html, because it doesn't exist Wink Are you defining a category ID in the request URL? If so, it should be possible to use that...

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
> >