Gossamer Forum
Home : Products : Links 2.0 : Customization :

Can you do this mod

Quote Reply
Can you do this mod
can you change on the homepage of links 2.0, 'the add a site' button so that when the add a site page opens up, that it comes up with an error message forbidden the user from adding a site on the homepage and must go into the catergory you want to add it to. The same function is in links-sql.

Tekno

Quote Reply
Re: Can you do this mod In reply to
All you need to do to accomplish this is to remove the "Add a Site' link from your home.html template, if you are using templates.

If you are not using templates, you need a new menu for the home page. In site_html.pl, find the following code:

Code:
$site_menu = qq~
<p><small class="menu">|
<a class="menulink" href="$build_root_url">Home</a> |
<a class="menulink" href="$build_add_url">Add a Resource</a> |
<a class="menulink" href="$build_modify_url">Modify a Resource</a> |
<a class="menulink" href="$build_new_url">What's New</a> |
<a class="menulink" href="$build_cool_url">What's Cool</a> |
<a class="menulink" href="$build_ratings_url">Top Rated</a> |
<a class="menulink" href="$build_email_url">Email Updates</a> |
<a class="menulink" href="$build_jump_url?ID=random">Random Link</a> |
<a class="menulink" href="$build_search_url">Search</a> |
</small></p>
~;
Just copy that code as follows (you can put the copy just below the above code):

Code:
$home_menu = qq~
<p><small class="menu">|
<a class="menulink" href="$build_root_url">Home</a> |
<a class="menulink" href="$build_modify_url">Modify a Resource</a> |
<a class="menulink" href="$build_new_url">What's New</a> |
<a class="menulink" href="$build_cool_url">What's Cool</a> |
<a class="menulink" href="$build_ratings_url">Top Rated</a> |
<a class="menulink" href="$build_email_url">Email Updates</a> |
<a class="menulink" href="$build_jump_url?ID=random">Random Link</a> |
<a class="menulink" href="$build_search_url">Search</a> |
</small></p>
~;
Note that the variable is now $home_menu and not $site_menu, and that the Add a Resource link has been removed.

Now go to sub site_html_home and change $site_menu to read $home_menu and that should be all you need to do.

While no error message will display telling them to go to the Category page, they still will not be able to add a link to your database from the home page.

I hope this helps.


- Bobsie
bobsie@orphanage.com
Quote Reply
Re: Can you do this mod In reply to
I use the following codes in the add.cgi file (which is based on the Category Select Codes that Bobsie wrote awhile ago):

1) Add the following codes in your sub main routine in the add.cgi file:

Code:

else {
if ($db_single_category) {
my %is_valid = map { $_ => 1 } &category_list;
$ENV{'HTTP_REFERER'} =~ s,/[^/]+\.[^/]+$,,;
$ENV{'HTTP_REFERER'} =~ m,$build_root_url/(.+?)/?$,;
if ($is_valid{$1}) {
&site_html_add_form ($1)
}
else {
&site_html_add_choose ();
}
}
else {
&site_html_add_choose ();
}
}


2) Add a new sub-routine in the site_html_templates.pl file called sub site_html_add_choose routine. This sub should look like the following:

Code:

sub site_html_add_choose {
# --------------------------------------------------------
# Recommend - Choose Category

&html_print_headers;
print &load_cgi_template ('add_choose.html', {
%in,
%globals
});
}


3) Create a new template file called add_choose.html. In this file, you can include the Category List OR Category Redirect tags that are defined in the following FAQ/Tutorial:

http://anthrotech.com/cgi/links/faqs/catlist/
http://anthrotech.com/...links/faqs/redirect/

What this will allow you to do is the following:

1) Keep the same header and footer files in ALL your pages including the homepage.
2) Reinforce browsing of your site, so that people have to choose a category before adding their site.

Hope this helps.

Regards,

Eliot Lee
Quote Reply
Re: Can you do this mod In reply to
In Reply To:
3) Create a new template file called add_choose.html. In this file, you can include the Category List OR
Category Redirect tags that are defined in the following FAQ/Tutorial:

http://anthrotech.com/cgi/links/faq/catlist/
http://anthrotech.com/cgi/links/faq/redirect/
Both result in:

"HTTP Error 404: File Not Found"

Just thought you should know.

- Bobsie
bobsie@orphanage.com
Quote Reply
Re: Can you do this mod In reply to
Thanks, Bobsie....

Smile

I edited my previous Reply to show the correct URLs.

Regards,

Eliot Lee
Quote Reply
Re: Can you do this mod In reply to
Thanks for your help people

tekno