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

Add/mod only in special cats - DONE

Quote Reply
Add/mod only in special cats - DONE
Ok; here we go:
To let users add their links only in that cats i want them to do, we do the following:
1. Set in links.pm the $LINKS{db_gen_category_list} = 0;
This would make adding only inside a cat; no list is shown.
Problem: In Admin you cant see the list, too :-)

So we add a new var: $LINKS{db_gen_category_list} = 1;
Now open all needed files for admin and search the orginal $LINKS{db_gen_category_list}
admin_html.pm (2x); db_utils.pm (3x), admin.cgi (2x) and change it to: $LINKS{db_gen_category_list2}

Now we need a new field for the cat-table; name it Catlist as char,4,4,Yes,Yes|No
To pass this new tag to our category.html (really to header.txt) we need a new line in the nph-build.cgi
in sub build_category_pages: there you find all tags for this:
add behind the one for the description ($OUT{description} = $category_r->{'Description'};)

the new one:

##--## Add only in Cat, when Catlist eq Yes
$OUT{Catlist} = $category_r->{'Catlist'};
##--##

Then you need some additional ifthens in your header.txt or where else you have the add-link.
[HTML]
<%if category_id%>
<%if Catlist eq 'Yes'%>
<a class="menulink" href="<Û_cgi_url%>/add.cgi?ID=<Êtegory_id%>">Add</a>
| <a class="menulink" href="<Û_cgi_url%>/modify.cgi?ID=<Êtegory_id%>">Modify</a>
| <%endif%>
<%if Catlist eq 'No'%>Add | Modify
<%endif%>
<%endif%>
[/HTML]
The whole mod is found again at http://www.adeva.de/links.htm



Robert