Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Adding info on to detail pages from catagorys

Quote Reply
Adding info on to detail pages from catagorys
Hi,

Ok i run a lyrics site with links sql and i am having trouble doing the following:

I would like a certain detail that was added when making a catergory to display on the detail page for example when i make the catergory AEROSMITH i would like to add a officaiol website address or other info and it to be displayed on the detail page off all links (lyrics) within that catergory.

The reason i want to do it this way is if some details change about an artist instead of having to go over 20 lyrics for that artist to change i just have to do it once for that catergory.

I know how to add a new field to the category add section but can not get anything to display on the detailed pages.

Thanks in advance
Kirk


--------------------------------------------------

Life isn't like a box of chocolates ... it's more like a jar of jalapenos. What you do today might burn your ass tomorrow.
Quote Reply
Re: [mekro] Adding info on to detail pages from catagorys In reply to
Its simple enough to do, but we would need the field names that you are trying to use/grab, to make the global work correctly :)

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] Adding info on to detail pages from catagorys In reply to
Hi Andy,

Well at the moment i cannot give you exact field names, as i will need quite a few for example official website, date of birth, place of birth and so on and so on.

If you could help me with a basic global that would be great as i could personally change the field names for each field within the global, i just do not know how to write a global YET (i will learn)

Thanks again
Kirk
Quote Reply
Re: [mekro] Adding info on to detail pages from catagorys In reply to
Mmm... in that case, you could try something like;

Code:
sub {

my $link_id = $_[0];

my $catlinks_tbl = $DB->table('CatLinks');
$catlinks_tbl->select_options('LIMIT 1');
my $cat_id = $catlinks_tbl->select( ['CategoryID'], { LinkID => $link_id })->fetchrow || return $GT::SQL::error;

my $category_tbl = $DB->table('Category');
my $cat_details = $category_tbl->select( { ID => $cat_id })->fetchrow_hashref || return $GT::SQL::error;

my @cat_details;
push (@cat_details, $cat_details);

return { cat_details_loop => \@cat_details }

}

... then try something like;

Code:
<%global_name($ID)%>

.. this will not produce anything, but will add the new tags for you....

Then, to show the category details, try something like;

Code:
<%loop cat_details_loop%>
<%Full_Name%>
<%endloop%>

<%Full_Name%> is just an example... all the category fields should work :)

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!

Last edited by:

Andy: Jan 27, 2004, 5:14 AM
Quote Reply
Re: [Andy] Adding info on to detail pages from catagorys In reply to
Hi Andy,

Thank you very much for your help, i am sorry to ask now but could you help me work out where to place everything, for example in my category i have the artists age and want to display it on the detailed page of all listings in that category, i place this as follows:

Under the template globals i create a new one called AGE with the code:

Code:

sub { my $link_id = $_[0]; my $catlinks_tbl = $DB->table('CatLinks'); $catlinks_tbl->select_options('LIMIT 1'); my $cat_id = $catlinks_tbl->select( ['CategoryID'], { LinkID => $link_id })->fetchrow || return $GT::SQL::error; my $category_tbl = $DB->table('Category'); my $cat_details = $catlinks_tbl->select( { ID => $cat_id })->fetchrow_hashref || return $GT::SQL::error; my @cat_details; push (@cat_details, $cat_details); return { cat_details_loop => \@cat_details } }

Then what do i do with the other 2, i think i know i should place the following code in my pages:

Code:

<%loop cat_details_loop%> <%AGE%> <%endloop%>

It is just the 2nd piece of code i have no idea what to do with or where to place it.

Thank you again for any help and i hope i am not being to needy.

Kirk
Quote Reply
Re: [mekro] Adding info on to detail pages from catagorys In reply to
You need the following at the very top of the template;

<%global_name($ID)%>

(change 'global_name' to whatever you named the global).

... then, wherever you want the <%AGE%> part to show, put something like this;

Code:
<%loop cat_details_loop%>
<%AGE%>
<%endloop%>

You can also check to see if the variables are there, by putting this in your template;

<%GT::Template::dump%>

Hope that helps.

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] Adding info on to detail pages from catagorys In reply to
Hi Andy,

Thanks alot for your help, i have done everything you mentioned, i created a new global with the code you gave me and called the global: other

I placed the global shortcut <%global_name($ID)%> at the top of my detailed page, however when building using the build all function it stalls at the creating detail page and displays the following error:

--------------------------

Building Detailed pages ...
A fatal error has occured:Can't call method "fetchrow_hashref" on an undefined value at (eval 27) line 7.


Thanks for any advice.
Kirk
Quote Reply
Re: [mekro] Adding info on to detail pages from catagorys In reply to
If you go into Setup > Misc, and set 'debug' to 2, then what does the error mesage say?

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] Adding info on to detail pages from catagorys In reply to
Hi Andy,

Here is what i get from the error:

---------------------------------------

GT::SQL::error = Failed to execute query: 'SELECT * FROM lsql_CatLinks WHERE ID = ? ' Reason: Unknown column 'ID' in 'where clause'
DBI::errstr = Unknown column 'ID' in 'where clause'

-------------------------------

Hope this helps
Kirk


--------------------------------------------------

Life isn't like a box of chocolates ... it's more like a jar of jalapenos. What you do today might burn your ass tomorrow.



--------------------------------------------------

Life isn't like a box of chocolates ... it's more like a jar of jalapenos. What you do today might burn your ass tomorrow.

Last edited by:

mekro: Jan 27, 2004, 4:33 AM
Quote Reply
Re: [mekro] Adding info on to detail pages from catagorys In reply to
Please try my modified version of the global above :) It was typo ($catlinks_tbl instead of $category_tbl).

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] Adding info on to detail pages from catagorys In reply to
Thank you, thank you, thank you,

It works perfectly.

Nice work.

Kirk


--------------------------------------------------

Life isn't like a box of chocolates ... it's more like a jar of jalapenos. What you do today might burn your ass tomorrow.
Quote Reply
Re: [mekro] Adding info on to detail pages from catagorys In reply to
Cool Cool

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!