Gossamer Forum
Home : Products : Gossamer Links : Discussions :

modify output for category link

Quote Reply
modify output for category link
Hi,

in the output from a search, links displays the category where the results came from in the seach output.

Is it possible to add a bit of text behind or in front of this, it appears on its own line above the links.html results and I cannot find this snippet of code in either links.html or category.html to amend it, is it buried somewhere else

Instead of just displaying the category name where the results came from I would like to add in front of it 'results from ...' and then the category name
hope that makes sense and thanks in advance for your help.

rgds

Kevin

Cheers
KevM
Quote Reply
Re: [KevM] modify output for category link In reply to
 

Regards

minesite
Quote Reply
Re: [KevM] modify output for category link In reply to
I'd like to identify where that Linked Category Results is derived also but for a different reason. The results have an unclosed <p> tag and I'd like to correct it. Search results:

Code:

<p> <a href="path/to/dir/page.html">Directory</a> : <a href="path/to/dir/page.html">Sub Directory</a>
--- links.html code here ---

There's a missing </p> tag in the auto-generated linked category.
Quote Reply
Re: [KevM] modify output for category link In reply to
"I cannot find this snippet of code"

Try:

admin/Links/User/search.pm

Line 131 - # Now format the category results.

Regards

minesite

Last edited by:

minesite: Feb 28, 2004, 12:29 AM
Quote Reply
Re: [Karen] modify output for category link In reply to
<p> <a href="path/to/dir/page.html">Directory</a> : <a href="path/to/dir/page.html">Sub Directory</a>
--- links.html code here ---

This may be in the search_results.html template.

Regards

minesite
Quote Reply
Re: [minesite] modify output for category link In reply to
In Reply To:
<p> <a href="path/to/dir/page.html">Directory</a> : <a href="path/to/dir/page.html">Sub Directory</a>
--- links.html code here ---

This may be in the search_results.html template.


Thanks. It appears that bit of code is generated within the <%link_results%> tag which is indeed in search-results.html. Unfortunately, source code of <%link_results%> isn't defined there. The code itself is inside this sub, wherever that may be located:

Code:

<%if link_results%><%-- Links in this category. --%>
<%link_results%>
<%endif%>
Quote Reply
Re: [minesite] modify output for category link In reply to
Hello Minesite
Quote:

Try:

admin/Links/User/search.pm

Line 131 - # Now format the category results

I found that bit ok in search.pm but making the smallest change i.e putting 'hello' in front of it started to give me internal server errors, is there a special string I need to use on this. I'm not too hot with perl.

rgds

Kev

Cheers
KevM
Quote Reply
Re: [KevM] modify output for category link In reply to
Hi KevM
Try adding "test" to the following code marked in red, if that works, progress further until your happy with the result.
Make sure you back up search.pm before you try it.

# Now format the category results.
my $count = 0;
my ($category_results, @category_results_loop);
if (!$filter and $cat_count) {
while (my $cat = $cat_sth->fetchrow_hashref) {
last if ($count++ > $args->{mh});
my $title = Links::Build::build ('title_linked', { name => $cat->{Full_Name}, complete => 1, home => 0 });
$category_results .= "<li>test$title\n";
$cat->{title_linked} = $title;
push @category_results_loop, $cat;
}
}

If you let us know exactly what you want to change it to we may be able to help further.

Regards

minesite
Quote Reply
Re: [minesite] modify output for category link In reply to
Hi Minesite,

I amended as you outlined but it doesn't seem to have changed anything which is also why in thought I was dpoing something wrong.

Attached is a small jpg of my result after making the amendment. You will see that the category link is not displaying 'test' before the category link to Avon

if I add anything after $title it throws me an error

thanks for your help.

Kevin

Cheers
KevM
Quote Reply
Re: [KevM] modify output for category link In reply to
Hmm, can't see the attachement so trying again..

Cheers
KevM
Quote Reply
Re: [KevM] modify output for category link In reply to
Avon and Bedfordshire are the Categories ?

Regards

minesite
Quote Reply
Re: [minesite] modify output for category link In reply to
yes they are.

rgds

Cheers
KevM
Quote Reply
Re: [KevM] modify output for category link In reply to
Hi KebM

Its looks like you are displaying and grouping your search results by category.
If thats the case the changes need to be made at line 167.

# Join the link results by category if we are grouping.
my @link_results_loop;
if ($CFG->{build_search_gb}) {
foreach my $cat (sort keys %link_output) {
my $title = Links::Build::build ('title_linked', { name => $cat, complete => 1, home => 0 });
$link_results .= "<p>test$title" . join ("", map { Links::SiteHTML::display('link', $_) } @{$link_output{$cat}});
$link_output{$cat}->[0]->{title_linked} = $title;
push @link_results_loop, @{$link_output{$cat}};

Same deal, make sure you back up.
You could probably achieve the same out come by setting up a modified search results link.html in a loop.
It would be better to do it in a loop as it would see you through upgrades etc.

Regards

minesite
Quote Reply
Re: [minesite] modify output for category link In reply to
Thinking about it, you should not really play around with the pm files.
Try something like this in search_results.html template.

<%loop link_results_loop%>
I want to put this in front of the category <%title_linked%><br>
<%include link.html%>
<%endloop%>

You will need to play around with it to get the desired result and may have to reference a new link.html template.

Also do a search for "loop" and "link_results_loop", they will give you a starting point.

Regards

minesite
Quote Reply
Re: [minesite] modify output for category link In reply to
Smile Thank you Minesite, it works exactly as I wanted it to.

In search_results.html

<!-- this has been added to get the category format sorted -->
<%body_font%>
<%loop link_results_loop%>
<font face="Verdana" size="2" color="#4682B4">- Results from</font><%title_linked%><font face="Verdana" size="2" color="#4682B4"> pages</font><br>
<%include link.html%>
<%endloop%>

<!-- Next/Previous links if spanning pages. -->
<%if next_span%> &nbsp;<tr><td colspan=2><%body_font%>
<small>Pages: <%next_span%></small></font> </td></tr>
<%endif%>
<%body_font%>


<!-- removed with above in its placed
<%link_results%>

-->

Doesn't seem to have any adverse affect on the results or output.

I never would have figured the loop bit or what it does so thanks loads for this.

kind rgds

Kevin

Cheers
KevM
Quote Reply
Re: [KevM] modify output for category link In reply to
No problems, glad I could help.

Regards

minesite