Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Display category column on detailed page?

Quote Reply
Display category column on detailed page?
Is is possible to pull data from a category column onto all detailed pages for links under that category?

For example, category: Quotes/Authors/Shakespeare

Category column: Author_bio

Can Author-bio appear on every detailed page for each quote under Shakespeare?
(as opposed to appearing just on the Shakespeare category page)

Thanks.

Thanks,
--Jo
Quote Reply
Re: [iplay] Display category column on detailed page? In reply to
Hi,

To have that work, you would need a global. Something like this:

get_category_details
Code:
sub {
my $tbl = $DB->table('CatLinks');
$tbl->select_options("ORDER BY CategoryID");
my $cat_id = $tbl->select ( ['CategoryID'], { LinkID => $_[0] } )->fetchrow;
my $cat = $DB->table('Category')->get( { ID => $cat_id } );
my $hit;
map { $hit->{"category_" . %_} = $cat->{$_} } keys %$cat;
return $hit;
}

(just wrote it, so unteested ;))

Call with:

<%get_category_details($ID)%>

..then call the category fields with category_ prefixing the fields, for example:

<%category_Full_Name%>, <%category_Number_of_Hits%>, etc

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] Display category column on detailed page? In reply to
Thanks Andy,

I set up that global but am not sure how to call it:

Just to test I inserted the following into detailed.html template

<%get_category_details($ID)%>
<%category_Full_Name%>

But this gives...
Unknown Tag: 'category_Full_Name'

Am I calling it wrongly?

Thanks,
--Jo
Quote Reply
Re: [iplay] Display category column on detailed page? In reply to
I've also tried using your ULTRAGlobals plugin Get_Links_Categories and that seems to come close to what I need, eg:

[/url]
<%Plugins::ULTRAGlobals::Get_Links_Categories($ID)%>

<ul>
<%loop cat_loop_for_link%>
<li><a href="<%URL%>"><%Full_Name%></a><br>
<%Author_bio%>
</li>
<%endloop%>
</ul>

The only snag is that it returns all the categories (eg Quotes/Topics/Love), which I don't need in this particular position.

If I run it something like below, I get just the author details that I need pulled from the Author category but without the link to the Author category.

[/url]<%loop cat_loop_for_link%>
[/url]<%if Author_bio%>[/url]<%Author_bio%>[/url]<%endif%>
<%endloop%>

Is there some way of modifying this to get the link, or would your original suggestion still be the way to go?? Thanks.
[/url][/url][/url]

Thanks,
--Jo
Quote Reply
Re: [Andy] Display category column on detailed page? In reply to
Oops, this line:

Code:
map { $hit->{"category_" . %_} = $cat->{$_} } keys %$cat;

Should be:

Code:
map { $hit->{"category_" . $_} = $cat->{$_} } keys %$cat;

Serves me right for rushing it ;)

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] Display category column on detailed page? In reply to
Thanks Andy, that works well. It pulls requested author data onto the detailed quote page from the author category.

Couple of questions:

1. Any way of getting it to link back to the author category page (which lists links to all the author's quotes)?

2. If I copy the link from the author category into say a topic category, all the author data is lost. Any way of keeping it?

Maybe this needs a plugin? Happy to pay.

The thing I'm trying to avoid is entering the same author data in again and again. Let's say Shakespeare has 500 quotes, each with a detailed page. I don't want to enter his name, dates, nationality etc 500 times when all the same info has already been entered for his main category page.

Thanks,
--Jo
Quote Reply
Re: [iplay] Display category column on detailed page? In reply to
To make it have a "URL" back to the main category, try adding:

Code:
$cat->{category_URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/$CFG->{build_index}";

...right after:

Code:
my $cat = $DB->table('Category')->get( { ID => $cat_id } );

Then link back with something like:

Code:
<a href="<%category_URL%>"><%category_Full_Name%></a>

Quote:
2. If I copy the link from the author category into say a topic category, all the author data is lost. Any way of keeping it?

Any reason you don't just add the same link to more than one category? =)

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] Display category column on detailed page? In reply to
That creates a link to: http://www.example.com/cgi-bin/ref/Unknown Tag: 'category_URL'

> Any reason you don't just add the same link to more than one category? =)

I think that's what I'm doing. In Admin, I click Copy and follow the instructions:
Please use the tree on your left to pick the category in which you want to copy the selected link or Click here to cancel

Frown

Thanks,
--Jo
Quote Reply
Re: [iplay] Display category column on detailed page? In reply to
Hi,

I don't tend to use the "Browse" function for doing that kinda stuff.

What I would do, is edit the link via Database > Links > Modify .

Then, on the bit where you can select the category, you are able to select more than one.

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!