Gossamer Forum
Home : Products : Links 2.0 : Customization :

Show/Hide Summaries

Quote Reply
Show/Hide Summaries
Bmxer's mod for this shows a button that says hide summaries, and show summaries...

http://lookhard.hypermart.net/...rt&TitleOnly=Yes

The only information I can find from this is saying that it can be modified from the
Hide Category Mod:

http://lookhard.hypermart.net/links-mods/

and a few little bits and pieces of information in these forums...

http://www.gossamer-threads.com/...um3/HTML/003260.html

But what I'm curious about is how to do it.

I'm guessing this is the main thing that needs to be modified:

Code:
if (($in{'NoCats'} == 0) or (!$in{'NoCats'})) {

to something like...

if (($in{'nosum'} == 0) or (!$in{'Nosum'})) {

But where would you put it? I'm sure I could figure it out to hide links completely, but I wish I could get it to hide the description only.

If anyone has this code and is willing to give it's simplicty away to help me for free, let me know...

Thanks,


------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
As the Mod states...

Where you see (in other words FIND)

Code:
# Build the HTML for the category results and store it in "$category_results". Only build the html
# if we are on the first set of link results.
foreach $category (@category_results) {
if ($nh == 1) {
$cat_clean = &build_clean($category);
$linked_title = &build_linked_title ($category);
$category_results .= qq|<li>$linked_title\n|;
}
$cat_hits++;
}
$cat_hits &#0124; &#0124;= 0;
$lowrange = ($nh-1) * $maxhits + 1;
$highrange = $nh * $maxhits;

in search .cgi, change this to (in other words REPLACE)

Code:
if (($in{'NoCats'} == 0) or (!$in{'NoCats'})) {
# Build the HTML for the category results and store it in "$category_results". Only build the html
# if we are on the first set of link results.
foreach $category (@category_results) {
if ($nh == 1) {
$cat_clean = &build_clean($category);
$linked_title = &build_linked_title ($category);
$category_results .= qq|<li>$linked_title\n|;
}
$cat_hits++;
}}
$cat_hits &#0124; &#0124;= 0;
$lowrange = ($nh-1) * $maxhits + 1;
$highrange = $nh * $maxhits;

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Show/Hide Summaries In reply to
Thanks Eliot,

But that isn't what I'm talking about. I'm asking how I can modify this mod to do the same thing with the summaries.

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
Has anyone gotten this?

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
Theres two ways you can do it, my way, which is more coded and doesn't allow me time right now to give any code because i have to go to school soon, or this way, just make another link.html templates => link2.html and only put the title and everything minus the Description tag. Then using the multiple templates faq do this, in site_html_templates.pl
put this in the sub site_html_link subroutine
Code:
if ($in{'nosum'} =~ "yes") { $template = "link2.html"; } else { $template = "link.html"; }
or something like that, I didn't do it this way, but i think Anthrorules[Eliot] has his this way.
Quote Reply
Re: Show/Hide Summaries In reply to
Nope...but close.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Show/Hide Summaries In reply to
Thanks, a least now I have an idea of how to do it. I'm guessing: (with nosum=1)

Code:

if (($in{'nosum'} == 0) or (!$in{'nosum'})){ $template = "link2.html";
}

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
Here is what I ended up using... Thanks everyone for the help...

Code:
# Show Summaries or Hide Summaries
$search = $in{'search'};
$query = $in{'query'};
if ($in{'nosum'} eq '1') {
$template = "link2.html";
$sum = qq~<a href="http://www.magicdirectory.com/cgi-bin/search.cgi?bool=or&query=$query&search=$search">Show Summaries</a>~;
}
else {
$template = "link.html";
$sum = qq~<a href="http://www.magicdirectory.com/cgi-bin/search.cgi?bool=or&query=$query&search=$search&nosum=1">Hide Summaries</a>~;
}

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
Yeah, true. Mine is alot different since i use the Query String so it just takes whatever is there and reprints it. I don't use the two subs in mine, i just say delete if ($in{'TitleOnly'} eq 'Yes') { (delete $rec{'Description'}); } but thats not all, but i can't release it now because i don't have much time to write help stuff.
Why do you have
if ($in{'nosum'} eq '1') {
it should be
if ($in{'nosum'} == 1) {

------------------
LookHard Search
lookhard.hypermart.net
Lavon Russell

Quote Reply
Re: Show/Hide Summaries In reply to
Thank You, I forgot about that...

Code:
$nh = $in{'nh'};

That should do it...

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
I also found problems with building the normal links, so I have changed the code a little... Ok here we go...

Code:
sub site_html_link2 {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.

my %rec = @_;

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});
# Show Summaries or Hide Summaries
if ($in{'nosum'} eq '1') {
$template = "link2.html";
$sum = qq~<a href="$build_search_url?bool=$in{'bool'}&query=$in{'query'}&search=$in{'search'}&nh=$in{'nh'}&nocats=$in{'nocats'}">Show Summaries</a>~;
}
else {
$template = "link.html";
$sum = qq~<a href="$build_search_url?bool=$in{'bool'}&query=$in{'query'}&search=$in{'search'}&nh=$in{'nh'}&nocats=$in{'nocats'}&nosum=1">Hide Summaries</a>~;
}
return &load_template ( $template, {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
rate_img => &get_rating_image($rec{'Rating'}),
%rec,
%globals
});
}

That should do it... Keep in mind there is still extraneous code...

------------------
- Jonathan Gamble

http://www.magicdirectory.com/

[This message has been edited by jdgamble (edited March 17, 2000).]
Quote Reply
Re: Show/Hide Summaries In reply to
Almost. The codes you provided will work fine if the search comes from the advanced search form. Although, be aware that if you add more search features, you will have to constantly edit the query string that you have in $sum variable.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Show/Hide Summaries In reply to
Thats gonna mess you up if your like on page 2 or something.
Quote Reply
Re: Show/Hide Summaries In reply to
 
Quote:
Yeah, true. Mine is alot different since i use the Query String so it just takes whatever is there and reprints it.

That is what I need your help on. How can I take the current url and reprint it without the '&nosum=1'?

Quote:
I don't use the two subs in mine, i just say delete if ($in{'TitleOnly'} eq 'Yes') { (delete $rec{'Description'}); } but thats not all, but i can't release it now because i don't have much time to write help stuff.

Ok, I don't use too subs either now. I just had that for temporary quick use.

I personaly would rather use two different templates because I don't want to delete just the description, I kind of want it looking different too.

Quote:
Why do you have
if ($in{'nosum'} eq '1') {
it should be
if ($in{'nosum'} == 1) {

It works either way.

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
Mine uses two template files....

And like Bmxer...I do not have the time to write up this Mod, nor the patience.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Show/Hide Summaries In reply to
I'm not asking for the mod, I'm just asking how I can reprint the whole query with all the inputs instead of having to do...

Code:
$build_search_url?bool=$in{'bool'}&query=$in{'query'}&search=$in{'search'}&nh=$in{'nh'}&nocats=$in{'nocats'}&nosum=1

everytime I add a new imput add $in{'query} or whatever.

------------------
- Jonathan Gamble

http://www.magicdirectory.com/




Quote Reply
Re: Show/Hide Summaries In reply to
Here are some hints...

1) Look for the $format_url variable in the search.cgi script.

2) Then look at the &site_html_link; reference...*hint* *hint*, you will need to reference the second template sub in the search.cgi script.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums