Gossamer Forum
Home : Products : Links 2.0 : Customization :

Blocking Categories Mod Error

Quote Reply
Blocking Categories Mod Error
Has anyone had success using the modification found at http://goodstuff.orphanage.com/rcat_mod.html known as the Links 2.0 Category Select List Mod? I am trying to use it to block entries to some categories and have yet to figure out what the error is but with so many modifications to several different files, it is real difficult for a beginner to find the mistake.

Would anyone be willing to share the 4 files with the modifications that they have installed and working?

Thanks!

Tammy

Quote Reply
Re: Blocking Categories Mod Error In reply to
I installed it and it works pretty good. As for sharing my files, no problem but I'm sure I have different MODs installed ( i've got almost a whole drawer of file folders devoted to each MOD...! ) so it would not be a good idea to just use my 4 files.

You're just gonna have to wade thru the instructions. I didn't have any annotations on my papers, so the instructions must have been very accurate. Just locate the code to change and do exactly what the instructions say to do. Remember to skip 2a unless you installed the previous version.

Gene
Quote Reply
Re: Blocking Categories Mod Error In reply to
Gene:

Thanks for trying! I have went back through and started all over again with no luck for the fourth time!

I entered just one category to block this time instead of more than one.

I made sure I did all of the replacements as instructed.

One problem I run into is when I try to open the nph_build.cgi in Notepad, I can't copy and paste the changes as the file is too big. I then have to open it in Wordpad which I feel might be a problem? If so, how can I change the file otherwise?

Tammy

Quote Reply
Re: Blocking Categories Mod Error In reply to
UPDATE:

Now rather than a 500 server error or the file not wanting to execute, I have made progress? But still not working right.

Now upon choose build all after uploading all changes and resetting permissions, I get this error:

Error Message : fatal error: Undefined subroutine &main::build_category_information called at nph-build.cgi line 287.

I went back through for the sixth time and redone the changes; this time, I copied the changes into a blank Notepad and then copied them from there into WordPad. This seemed to work better as it kept the format of the script.

I am including the modifications I made to the nph-build.cgi script (am I putting the new subroutine in the wrong place?)

Here are the changes to nph-build.cgi: If anyone can help, please?


________________

&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, _, / and -.");
}
return $input;
}

sub build_category_select_list {
# --------------------------------------------------------
# This subroutine will build a category select list of only desired subcategories.
my ($subcat, @rootcat);
my $cat_select_list = $db_script_path . "/data/cat_sel.txt";
print "\tOpening file: $cat_select_list\n";
open (SELECT, ">$cat_select_list") or
&cgierr ("unable to open $cat_select_list. Reason: $!");
print SELECT qq|<select name="Category">\n <option>---\n|;
foreach $subcat (sort keys %category) {
if ($subcat !~ /^\s*$/) { push (@rootcat, $subcat); }
}
$category = &site_html_cat_select_list (@rootcat) if ($#rootcat >= 0);
print SELECT $category;
print SELECT qq|</select>\n|;
print "\tClosing file.\n";
close SELECT;
}

1;

_______________

This is a snippet of the subroutine I added and a few lines before it and a few lines after.

__________________

Here is the first modification with the routine before and follwing:

# Create Category Select List if appropriate
if (@exclude_categories) {
print "Building Category Select List . . .\n";
&build_category_select_list;
print "\tDone\n\n";
}
else {
print "No Categories to Exclude\n";
print "Category Select List not built\n";
print "Default category list will be used\n\n";
}

# Create Category Select List if appropriate
if (@exclude_categories) {
print "Building Category Select List . . .\n";
&build_category_select_list;
print "\tDone\n\n";
}
else {
print "No Categories to Exclude\n";
print "Category Select List not built\n";
print "Default category list will be used\n\n";
}

# Generate detailed view pages.
if ($build_detailed) {
print "Generating detailed view pages . . . \n";
&build_detailed_view;
print "Done\n\n";

Does anyone see a problem?

Quote Reply
Re: Blocking Categories Mod Error In reply to
The error indicates that you have not added all the relevant subroutines in the site_html_templates.pl file.

Refer to the MOD instructions again, Undefined subroutine means just that...it is not defined (or better semantics...not found), which means that the script cannot execute.

Regards,

Eliot Lee
Quote Reply
Re: Blocking Categories Mod Error In reply to
check out these text editors.....

ConText http://www.fixedsys.com/context/ this one is free and great....! ( just have to watch what you copy from this message board cause it handles the tab character kinda funny at time. I use this to do almost all of my editing of cgi files ( and a lot of html files, that and the coffeecup.exe editor that I bought ). Search and replace is great.....even tried to send him some money but its hard to send money to croatia...

EditPadClassic http://www.jgsoft.com/ is free. I have an earlier version and just copied it to my system folder and renamed to notepad.exe ( renamed orignal notepad.exe to notepado.exe )

I saw what Eliot had to say. Let me know if it works....

Gene
Quote Reply
Re: Blocking Categories Mod Error In reply to
the code that you added at the bottom of nph-build -- sub build_category_select_list { appears to be OK

But as regards the following

In Reply To:
Here is the first modification with the routine before and follwing:

# Create Category Select List if appropriate
if (@exclude_categories) {
print "Building Category Select List . . .\n";
&build_category_select_list;
print "\tDone\n\n";
}
else {
print "No Categories to Exclude\n";
print "Category Select List not built\n";
print "Default category list will be used\n\n";
}

# Create Category Select List if appropriate
if (@exclude_categories) {
print "Building Category Select List . . .\n";
&build_category_select_list;
print "\tDone\n\n";
}
else {
print "No Categories to Exclude\n";
print "Category Select List not built\n";
print "Default category list will be used\n\n";
}
this appears to be duplicate code....but maybe you were just posting this way. So check you nph-build.cgi to make sure it is there just one.

In Reply To:
Now upon choose build all after uploading all changes and resetting permissions, I get this error:

Error Message : fatal error: Undefined subroutine &main::build_category_information called at nph-build.cgi line 287.
It is looking for the subroutine build_category_information. But check your nph-build.cgi file for this subroutine ( should be just before the sub build_stats routine ). and check the spelling carefully everywhere. It just has to be there................!!!!!!!

Gene
Quote Reply
Re: Blocking Categories Mod Error In reply to
AAAGGHHH!!! I have tried over and over; starting from scratch each time and paying close attention with no luck!

Is there anyone willing to send me these files with these modifications?

I'm overlooking something but haven't figured it out yet and I can install scripts and make them work, but I CANNOT troubleshot very well at all (since I have no clue what this stuff does).

I'm moving my entire site which now consists of over 100 pages from an NT server to a Unix server just so I can use this script and make it automated! I run a unique links site, and this would make my life so much easier! At least I thought so!

I know there's somebody out there who can help. I have tried at least 10-12 times now without any luck. The only thing I haven't done is the is step a to the add.cgi file which says to skip it. I'm pretty sure this isn't the problem anyways.

HELP!!! Tammy

Quote Reply
Re: Blocking Categories Mod Error In reply to
Well, like I said, I don't have a problem with sending you my files but just the opposite would occur. You would have to delete sections in each one because of the MODs that I have aleady installed...you'd end up getting different error messages and then you would have to try to find the offending code and delete....kinda like the problem that you have now, based on what you have said.

I suggest you pay someone to do the installation and MODs for you, if you really are not sure of what your are doing. Check out the Resources section.

If you want to send me the four files or post them on a web page for downloading, I will be happy to look them over. ( Do NOT post them to this forum.....would be way to long ).

Or give me, or someeone, instructions to access your admin folder and I'll take a look.

Or send me and email...

Links does work and is a great program....the MODs can be a little tricky as you have discovered.....but they all work pretty much as advertised....

Gene
Quote Reply
Re: Blocking Categories Mod Error In reply to
trwebworks

Did you save copies of site_html_templates, etc., before the mod was added? This is always a good policy so that you can go back to something that works in case things blow up. Also, do not use WordPad. It does some funny things to the code. Try one of the editors that Gene mentioned, or try any of the loads of other text editors out there. A good place to look is http://www.completelyfreesoftware.com. See if you can carefully undo the mod and get the script working again. Then make copies and try it again. In fact, you might want to set up a beta copy of the whole script on your server so that you can test out stuff before adding it to the public site. I thought I'd pass on the general way that I have found to be the safest way to fool with the code. I hope you get it fixed. Smile

DT

Quote Reply
Re: Blocking Categories Mod Error In reply to
DT mentioned some good points.

When I do a MOD ( at least a complicated one ) I just copy the server files to my hard drive -- or at least the nph-build and site_html_templates -- those are the one that get most of the changes...I did set up a test site but don't really use it....that's better for the progammers who are creating MODs...us cut and paste folks don't do that much that can't be undone pretty easily....you and I are excellant examples of uninstalling MODs...

and remember to document the MOD, e.g.,

# Prevent Category MOD ESM. 11-07-00

I also print each one out and put it in it's one folder folder. I put a brief listing of what files were changed/added, what routines where changed/added, and any additional instructions/claifications that were needed. A couple of MODs had corrections/clarification in messages in this forum that never found there way into author's instruction.

Another good source for free programs is http://www.NONAGS.com



Gene
Quote Reply
Re: Blocking Categories Mod Error In reply to
UPDATE!!!!

I took the time this morning to download Edit Pro and guess what, first time through, I had the mod up and running! It took me about 10 minutes total time!

All along, it was Notepad/Wordpad that was causing the errors!

Now, I'm adding the categories to be blocked without trouble!

Thank you to everyone for taking the time out of your (I'm sure busy) day to help! I knew I should've downloaded another text editor quite some time back, but I really haven't used any scripts in a couple of years so I haven't had the need. I will use this from now on and see the guy who created it (as well as everyone else for these wonderful scripts and utilities) something for my appreciation!

Thanks a LOT!

Tammy

Quote Reply
Re: Blocking Categories Mod Error In reply to
What is the author's website for Edit Pro? Or where did you download it from? I'd like to take a look at it.

But ConText at http://www.fixedsys.com/context/ is very hard to beat for pearl programs.

Glad all is working for you. Let us know your URL when you get it up and running.

Gene
Quote Reply
Re: Blocking Categories Mod Does Not Work Cause.. In reply to
Hello,

With all due respect I think you people whom are experts simple forget that if things, the simplest things are not put into laymans terms many of us who are trying very hard to learn....do not understand. I think this mod is a perfect example. Obviously the creator is very talented, and he took a lot of time to post this mod. For many of you it was easy. Heck, following the editing part was easy enough for me but yet the mod does not work. Why? Because allthough the author was very diligent about giving the edits PEFECTLY he never did tell us the most important part. HOW to add the category you want excluded from public use in the links.cfg. Here is exactly ALL it says about adding a category:

This is accomplished by simply adding category names to an array, @exclude_categories, which will be in links.cfg

Ok, I get syntax errors, or general errors no matter how I try to add this to links.cfg Here is the original line we were instructed to add in links.cfg

@exclude_categories = (); Try as I may, I have not been able to add a category to this line in any way shape of form.
@exclude_categories = (Directory);
@exclude_categories = ();Directory
@exclude_categories = Directoy();
@exclude_categories = ()Directory;

ZIP, nothing. I am absolutely possitive everything I edited in all the files is correct, and exactly as it was posted. I simply was never given the correct way to add the category to this line.

Can anyone please tell me exactly the correct way to enter the Cats in this @exclude_categories = ();?

Thank you very much.
Doug

Quote Reply
Re: Blocking Categories Mod Does Not Work Cause.. In reply to
Ok,

I have gotten ONE category blocked. I used this:
@exclude_categories = (Webmasters);

This works without an error. The problem no is I can't add sub categories because I do not know the proper way to add. I have tried all the followingL
@exclude_categories = (Webmasters,Webmasters/Business);
@exclude_categories = (Webmasters, Webmasters/Business);
@exclude_categories = (Webmasters,Webmasters/Business);
@exclude_categories = (Webmasters),(Webmasters/Business);

Someone please show me the proper syntex for adding cats, and subs. It does work if the cats are added properly here. I have the "Webmasters: cat blocked, just can't do any subs.

Thank you,
Doug
@exclude_categories = (Webmasters);

Quote Reply
Re: Blocking Categories Mod Does Not Work Cause.. In reply to
For one use....

@exclude_categories = ('Directory');

or two.....

@exclude_categories = ('Directory','Directory2');

etc.....



Paul Wilson.
http://www.wiredon.net/gt/
http://www.perlmad.com/
Quote Reply
Re: Blocking Categories Mod Does Not Work Cause.. In reply to
Paul,

Thanks,This works now. I did not mean to be rude but I tried about everyting I could think of. I'm a computer repair technician and I'm pretty sharp on a lot of things but I'm no programmer, or perl programmer. I usually figure things out sooner or later because I never give up but it helps to have people in the know coaching you.

Off to the next mod. The Yahoo Directory 2.01 has got me working hard too:-))

Thanks,
Doug

Quote Reply
Re: Blocking Categories Mod Does Not Work Cause.. In reply to
Actually, I wish I were an expert in perl...I don't know a perl from an oyster. I even bought a perl book but it is still "greek" to me. I too have installed MODs only to find that I forgot one little simple thing or the author omitted a small step or there was a small change the appeared in the message boards but never made it to the MOD. So when it doesn't work, I don't have a clue.

For the most part the MODs do work as advertised and the installation instructions do work. The authors are to be commended for some really good work and more importantly sharing them with the Links community. G-T really should find a way to pay these guys for adding significant functionality to the product. It would really be nice if G-T would incorporate some of them in an update to version 2.0 ( hope, hope ).

In looking at your posts maybe you didn't follow all the instructions of step 1 which read

At the bottom of the Build Options section (just before the Date Routines section), add the following:
# Exclude Categories: a list of categories you do not want people to
# add categories in. Entries are contained within single quotes and
# separated by commas. Any change to this variable requires a rebuild
# of pages in order for the change to take effect.
Code:
@exclude_categories = ();
As I read that, the @exclude_categories = ();should look something like

@exclude_categories = ('category1','category2');

You had something like

@exclude_categories = category1, category2);

As for how to enter it, I have learned that the @name is some sort of an array and if I can harken back to my math class in my school days ( from long, long ago ), elements in an array are separated by a comma. And if I learned nothing else about programming languages, they consistenly put quote marks around text ( single quotes seems to be the preferred and sometimes the only way ). Find a source ( book, website, etc ) that will help with some basic Perl and some of this stuff will be easier.

I struggle like you with the MODs. But I have learned to be very, very picky about following the instructions very precisely. Make back up of key files and document the file when you make mods to it.

You will find a great group of folks here and they will all try to help in their own way. I am glad that Paul was able to help you and that you got it run properly. This stuff ain't easy so hang in there.

Smile

Gene