Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

MOD: Add Resource only to specific categories

Quote Reply
MOD: Add Resource only to specific categories
I've come up with the following to restrict the categories people can submit to;

First add a new field to your category table:

Column: isSub
Type: CHAR
Form Length: 3
Max Length: 3
Not Null: YES
Default Value: YES (people can submit as default)
Validation: YES|NO
Index Weight: 0

Next update nph-build.cgi at # Get the category info. and at the end of the $OUT list add the following: $OUT{isSub} = $category_r->{'isSub'};

Now in your category template/footer change the Add Resource link to the following:

<%if isSub eq 'Yes'%>
<a href="<%db_cgi_url%>/add.cgi?ID=<%category_id%>">Add Resource</a>

To turn OFF submissions, simply add/edit a category and change isSub to NO.

Make sure at least one category has 'isSub' changed to YES, then re-build your directory to effect the changes.

Update Sept 2000
Have been informed that this mod doesn't work if you're using page.cgi and displaying links 'on the fly' as the mod requires the 'Suggest/Submit' link is hard-coded into a generated static HTML page.

If anyone mod's it to work with page.cgi let me know :)

All the best
Quote Reply
Re: MOD: Add Resource only to specific categories In reply to
Hiho, dont know something about page.cgi; i have never used it before, but you can do a lot of things only with new field and the if or ifnot-expressions.

You could say: Only ifnot cats, write add, if you want only the deepest cats for public adding;
another thing is to make a new field in cat-table; named add (Yes/No);
then you ask at the templates: If ad eq Yes then write add.

I have done very complicated things only with new fields and special values in it; cause you could nest the if/ifnot and use eq too, a lot of things are possible.