Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How do I edit the <%category%> tag?

Quote Reply
How do I edit the <%category%> tag?
This is for Links SQL 2.1.0. I used to know how to do this, but now forgot. How do I edit tags, specifically the <%category%> tag that is in the home.html template? After I started creating new categories, the result I get is something like:

Categories:

Category 1
<>Subcategory 1, <>Subcategory 2

I'm trying to get rid of these annoying <> characters (what exactly are they for anyway??). Thanks for any help.
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
Hi,

If the <> stuff is just in your category name, it should be as simple as editing subcategory.html. Find:

<%Name%>

..and replace with:

<%Clean_Special($Name)%>

..then add a new global, called "Clean_Special", with the following code:

Code:
sub {
my $tmp = $_[0];
$tmp =~ s/[\<\>]//;
return $tmp;
}

Hopefully that works - still a little early over here in the UK =)

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] How do I edit the <%category%> tag? In reply to
Hi Andy,

Unfortunately it didn't work. In subcategory.html, I only found <%Short_Name%>, which I found to be part of the category, not subcategory lol. Any other ideas? The reason I really need to know exactly where to look for is because I would probably end up editing some other tags that are included when I add the following code to any template:

<%GT::Template::dump%>

I've been searching for hours, and still can't find it. Please help, thanks.
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
Mmm, not sure I see the problem. <%Name%> shouild work, or just use:

<%Clean_Special($Short_Name)%>

..instead.

(unless I 'm misunderstanding the issue)

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] How do I edit the <%category%> tag? In reply to
Believe it or not, say I did the following:

<%Short_Name%>test

Then the example I gave above will become:

Categories:

Category 1test
<>Subcategory 1, <>Subcategory 2

If you look more at the code within subcategory.html, you'll see what I mean. For example, it includes code for <sup>new</sup>, you know when the category has a new link inside, you'll see the small word "new" in red right after where it says "Category 1", just like exactly where the word "test" is right now? I'm telling you, subcategory.html is NOT what you think, at least not in home.html, which is where I'm having this <> problem...
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
Are you using YahooSubCats ?

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] How do I edit the <%category%> tag? In reply to
Yes sir. I did look into it before to see if the answer was there, but lemme triple-check something...
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
Thats where your problem is then =) You need to edit /admin/Plugins/YahooSubCats.pm. I don't have a copy anywhere, but post the file - and I'll show you what to edit.

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: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
...and I didn't find anything about this <> problem I'm having. I'm almost 100% positive it has to do with somehow finding out where the hell this <%category%> tag came from, and I must edit that piece of code manually, but I can't seem to find where it is?!? Frown
Quote Reply
Re: [Andy] How do I edit the <%category%> tag? In reply to
Ok, here's the entire file:

# ==================================================================
# Plugins::YahooSubcats - Auto Generated Install Module
#
# Plugins::YahooSubcats
# Author : Mel
# Version : 1.3
# Updated : $Id: YahooSubcats.pm,v 1.9 2001/01/26 01:05:56 alex Exp $
#
# ==================================================================
#
package Plugins::YahooSubcats;
# ==================================================================
use strict;
use Links qw/$IN $DB $CFG/;
use Links::Plugins;

sub create_subcats {
# ------------------------------------------------------------------
# Sets the description for Yahoo Style Subcategories.
#
my $subcat = shift;
my $cat_db = $DB->table('Category');
my $cfg = Links::Plugins::get_plugin_user_cfg ('YahooSubcats');
for (my $x=0;$x<scalar(@$subcat);$x++) {
my $cat_r=$subcat->[$x];
if ($cat_r->{Description} =~ /SUB0/ || $cat_r->{Description}=~/SUB1/) {
my $catid=$cat_r->{ID};
my $table = $DB->table('Category');
my $sth=$table->select({'FatherID' => $catid},['Full_Name','Name']);
my $description="";
my $len=0;
my $numcats=1;
while (my $row=$sth->fetchrow_hashref()) {
my $cat_url = $CFG->{build_root_url} . "/" . $cat_db->as_url ($row->{Full_Name}) . "/" . $CFG->{build_index};
if (($cfg->{limit_by} eq 'L') and (($len + length($row->{Name})) > $cfg->{subcat_length})) {
if ($cat_r->{Description}=~/SUB1/){
$description.='...';
last;
}
else {
$description.=",<br>";
$len=0;
$numcats=0;
}
}
elsif (($cfg->{limit_by} eq 'N') and (($numcats) > $cfg->{num_subcats})) {
if ($cat_r->{Description}=~/SUB1/){
$description.='...';
last;
}
else {
$description.=",<br>";
$numcats=1;
$len=0;
}
}
$len!=0 and $description.=',';
$len+=length($row->{Name});
$numcats++;
$description.=qq|<a href="$cat_url"><$cfg->{subcat_font}>$row->{Name}</font></a>|;
}
if ($cat_r->{Description}=~/.SUB[01]/s) {
$description="<br>".$description;
}
if ($cat_r->{Description}=~/SUB[01]./s) {
$description.="<br>";
}
$cat_r->{Description}=~s/SUB[01]/$description/;
$subcat->[$x]=$cat_r;
if ($subcat->[$x]->{Description}=~/SUB[01]/){$subcat->[$x]->{Description}=~s/SUB[01]//;}
}
}
return $subcat;
}
sub about {
print $IN->header();
print Links::header ('YahooSubcats Help Menu', qq|
<p>This plugin allows you to automatically generate Yahoo Syle subcategories. For instance, if you have
a category Computers, with subcategories Hardware, Software and Companies, using this mod, your main listings
will automatically look like:
<blockquote>Computers<br><font size=-1 color="blue"><u>Hardware</u>, <u>Software</u>, <u>Companies</u></font>
</blockquote>
<p>To do this, simply place either the word SUB0 or SUB1 as the <i>Description</i> for the category you want.
<p>If you specify SUB0, all subcategories will be listed. If you specify SUB1 the first few subcategories
will be listed up to subcat_length characters.
| );
}
# Always end with a 1.
1;

Last edited by:

V.E.C.T.O.R.: Jun 1, 2009, 1:19 AM
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
Ok, find:

Code:
while (my $row=$sth->fetchrow_hashref()) {

..and add this after it:

Code:
$row->{Name} =~ s/\Q<>//;

See if that works.

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] How do I edit the <%category%> tag? In reply to
Oh God, I'm afraid either what you suggested isn't working (because I did what you said but it still doesn't work), or I just don't know how to edit plugins correctly, as evidenced by the following post:

http://www.gossamer-threads.com/...?post=305967;#305967

I mean, I can't just download the YahooSubcats.pm file into my pc, open it in Wordpad, edit & save it, and reupload it? I don't know what the hell I'm doing wrong here, but no matter what I do with the plugin, it doesn't work, or at least it didn't work with the Auth_vBulletin plugin. I say this because 5 seconds ago I got curious so I blanked out the file so that it has no code in it, tried to build all and got an error. This means that Links must be reading off the current file, so after I uploaded the file again with the updated code, no more error. But still, what you said didn't work. Strange huh?!? Frown
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
MMm, send over FTP details, and I'll have a quick look for you. What you are doing should have worked fine.

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: Jun 1, 2009, 1:42 AM
Quote Reply
Re: [Andy] How do I edit the <%category%> tag? In reply to
Wow, I found something amazing that solved the problem. Give me a few minutes to double-check something and I'll post what I've found...
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
Ok, so I have two versions of YahooSubcats Version 1.3. One is what I downloaded a few years ago. Another is what I posted above, that I downloaded recently. Long story short, I stopped developing my website for a few years due to personal reasons, and now I'm finally back to almost reopening my website. So I'm in the midst of moving all my files into a new server, to get a fresh start, which is why I have two versions of everything. Anyway, I thought they were exactly the same thing, but it turns out that there is a VERY slight different pieces of code here and there that must have been the source of this strange "<>" problem I've been having (and I compared them side-by-side and couldn't figure out how the hell this new version can cause this weird problem, maybe you can Andy?). Once I uploaded the one I got a few years ago, the problem disappeared, so if anyone else is having this problem, now you know why. Here is the version that is the "good" one:

# ==================================================================
# Plugins::YahooSubcats - Auto Generated Install Module
#
# Plugins::YahooSubcats
# Author : Mel
# Version : 1.3
# Updated : $Id: YahooSubcats.pm,v 1.9 2001/01/26 01:05:56 alex Exp $
#
# ==================================================================
#
package Plugins::YahooSubcats;
# ==================================================================
use strict;
use Links qw/$IN $DB $CFG/;
use Links::Plugins;

sub create_subcats {
# ------------------------------------------------------------------
# Sets the description for Yahoo Style Subcategories.
#
my $subcat = shift;
my $cat_db = $DB->table('Category');
my $cfg = Links::Plugins::get_plugin_user_cfg ('YahooSubcats');
for (my $x=0;$x<scalar(@$subcat);$x++) {
my $cat_r=$subcat->[$x];
if ($cat_r->{Description} =~ /SUB0/ || $cat_r->{Description}=~/SUB1/) {
my $catid=$cat_r->{ID};
my $table = $DB->table('Category');
$table->select_options('ORDER BY Full_Name');
my $sth=$table->select({'FatherID' => $catid},['Full_Name','Name']);
my $description="";
my $len=0;
my $numcats=1;
while (my $row=$sth->fetchrow_hashref()) {
my $cat_url = $CFG->{build_root_url} . "/" . $cat_db->as_url ($row->{Full_Name}) . "/" . $CFG->{build_index};
if (($cfg->{limit_by} eq 'L') and (($len + length($row->{Name})) > $cfg->{subcat_length})) {
if ($cat_r->{Description}=~/SUB1/){
$description.='...';
last;
}
else {
$description.=",<br>";
$len=0;
$numcats=0;
}
}
elsif (($cfg->{limit_by} eq 'N') and (($numcats) > $cfg->{num_subcats})) {
if ($cat_r->{Description}=~/SUB1/){
$description.='...';
last;
}
else {
$description.=",<br>";
$numcats=1;
$len=0;
}
}
$len!=0 and $description.=', ';
$len+=length($row->{Name});
$numcats++;
$description.=qq|<a href="$cat_url" class="subcategory">$row->{Name}</a>|;
}
if ($cat_r->{Description}=~/.SUB[01]/s) {
$description="<br>".$description;
}
if ($cat_r->{Description}=~/SUB[01]./s) {
$description.="<br>";
}
$cat_r->{Description}=~s/SUB[01]/$description/;
$subcat->[$x]=$cat_r;
if ($subcat->[$x]->{Description}=~/SUB[01]/){$subcat->[$x]->{Description}=~s/SUB[01]//;}
}
}
return $subcat;
}
sub about {
print $IN->header();
print Links::header ('YahooSubcats Help Menu', qq|
<p>This plugin allows you to automatically generate Yahoo Syle subcategories. For instance, if you have
a category Computers, with subcategories Hardware, Software and Companies, using this mod, your main listings
will automatically look like:
<blockquote>Computers<br><font size=-1 color="blue"><u>Hardware</u>, <u>Software</u>, <u>Companies</u></font>
</blockquote>
<p>To do this, simply place either the word SUB0 or SUB1 as the <i>Description</i> for the category you want.
<p>If you specify SUB0, all subcategories will be listed. If you specify SUB1 the first few subcategories
will be listed up to subcat_length characters.
| );
}
# Always end with a 1.
1;
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
You can use WinMerge to compare files - it free, and very effective :)

http://winmerge.org/downloads/

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] How do I edit the <%category%> tag? In reply to
Hey Andy, I fell asleep on my chair right after I wrote my last post, but I wanted to say thanks for helping me out. I don't think I could've went through all my options so fast and eventually figured out my own problem unless you were there. That's how sometimes we solve problems I guess, by indirect help & motivation from others. I'll download that cool app and use it next time I compare files. Gotta go to work now, see ya later. :D
Quote Reply
Re: [V.E.C.T.O.R.] How do I edit the <%category%> tag? In reply to
NP, glad to have helped =)

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!