Gossamer Forum
Home : Products : Links 2.0 : Customization :

template-based tree_mod!

Quote Reply
template-based tree_mod!
LaughOK Everybody!! The new version of Links Tree has been added to the Resource section, titled Links Tree Template. Just added Saturday evening, wait for validation...
It has been changed slightly since my last post; see if adding a site map/tree like the one at http://southernarizona.com/links/map/ will enhance your site!

Leonard Laugh

It's Tuesday, and still not in the resource section...so for those that are anxious to try this mod out, it can be found at http://southernarizona.com/...n/tree_template.html. If you have any problems with it, let me know, I'll see what I can do...

[updated Feb 6, 2001]
Quote Reply
Re: template-based tree_mod! In reply to
Sounds good, Leonard!

I have a suggestion on improving the Tree Mod:
You know how Links2 also builds the "New" and "Cool" pages (and any other extra templates that you wish to add - instructions for adding extra templates in Resource Center - FAQ section - http://www.findinghim.com/links_mods/templates/). Perhaps you and your brother can come up with a way to add these pages to the tree mod. It's over my head.

The idea is that the tree mod should be able to include ALL of the directories and pages of the entire site, not just the category pages.

This capability, combined with your brother's template mod, would make the tree mod a super tool!

Thanks, again, Leonard! SmileSmile

DT

Quote Reply
Re: template-based tree_mod! In reply to
D.T.

Thanks for the kind words! I don't actually use those features (new, cool), but I can see how having them in the site map would be good. We'll see about adding them to the mod, but don't hold your breath...

Leonard

Quote Reply
Re: template-based tree_mod! In reply to
I ain't holdin', but thanks for the effort, Leonard! Smile Smile

In case the tree mod can't cover all the directories, here's a script that does the job pretty well:

http://www.ev-stift-gymn.guetersloh.de/server/tree_e.html

Thanks, again.

Quote Reply
Re: template-based tree_mod! In reply to
How would I get rid of the _(under score) in the category title?

Quote Reply
Re: template-based tree_mod! In reply to
$cat_name = &build_clean($category_name);

<a href="">$cat_name</a>

Regards,

Eliot Lee
Quote Reply
Re: template-based tree_mod! In reply to
Hi Leonard

Thanks so much for this. I'm sure lots of folks will want to use it.

I got an error when I first tried it. Down at the bottom of the new nph-build sub, you have:

In Reply To:
$title_linked = &build_linked_title ("map");
open (MAP, ">$build_site_map_path/$build_index") or cgierr ("unable to open site map page: $build_map_path/$build_index. Reason: $!");
print MAP &site_html_site_map;
close MAP;
}
I changed it to:
In Reply To:
$title_linked = &build_linked_title ("map");
open (MAP, ">$build_site_map_path/$build_index") or cgierr ("unable to open site map page: $build_map_path/$build_index. Reason: $!");
# print MAP &site_html_site_map; ## ORIGINAL
print MAP &site_html_print_map;
close MAP;
}
to match the site_html_templates.pl sub name.

Otherwise, so far so good. Tell your bro' thanks, too!

DT

Quote Reply
Re: template-based tree_mod! In reply to
Thanks for the input! I will change the code to avoid that problem. All the listing on my site map are underlined (links), and didn't realize they were undersored instead of spaced...will also add that that change. If anyone wants to add a message board (like the one on my site), it's a free, easy-to-use, and very well done (like Links) script from http://www.ikonboard.com.

Leonard

UPDATE: After a little code work...

When I make the change DT mentions, the map builds fine, but does not use my template, so if there's a problem building using print_MAP &site_html_print_map; then maybe your template is not set up right...? Will work on this situation this weekend, and post any corrections.

[edited by Leonard 10:10 Feb, 9]
Quote Reply
Re: template-based tree_mod! In reply to
You're right. It's not using the template. But it wouldn't build for me using the original code because of the reference to print MAP &site_html_site_map;, which doesn't exist. That's why I renamed it.

sub site_html_print_map has to be changed I believe to refer to a sub that has the template in it. The code you posted doesn't have that template sub. Rather, it has the HTML within the sub.

Check out what your code looks like and see if there is a difference.

Thanks, Leonard.

DT

Quote Reply
Re: template-based tree_mod! In reply to
The site map page is generated but it does not use the template on mine.

Quote Reply
Post deleted by leonard In reply to
Quote Reply
Re: template-based tree_mod! In reply to
Okay, have made some minor changes: the underscores are gone, and the number of links in each category and sub-cat are shown. Is this hack working for folks? Thanks, and enjoy!

LeonardSmile

Quote Reply
Re: template-based tree_mod! In reply to
Works great, Leonard. Thanks! Smile

Quote Reply
Re: template-based tree_mod! In reply to
same error as before! if i change the "print MAP &site_html_site_map;" to "print MAP &site_html_print_map;"
the site map page is generated but it does't use the template. if i don't change it, i allways get the error
message: undefined subroutine &main::site_html_site_map

mike

Quote Reply
Re: template-based tree_mod! In reply to
Well, it still doesn't work as posted (generates undefined sub error/doesn't use template if you change the name). However, I made it work by adding this sub to site_html_templates.pl -- leave the names of everything as they are given in the instructions and just add this:

Code:
sub site_html_site_map {
# --------------------------------------------------------
# This routine is used to display what the sitemap should
# look like.
my $site_map = &site_html_print_map;
return &load_template ('map.html', {
site_map => $site_map,
grand_total => $grand_total,
%rec,
%in,
%globals
});
}

The grand total doesn't have to be there, but if you include it you can put your total links on the map page.

There are some HTML errors site_html_print_map that should be corrected to prevent display problems:
- font tags are not inside TD tags
- verdana misspelled as verdona
- transposed table tags in last output line: </tr></td></table> should be </td></tr></table>

Hope that helps people trying to get this mod to work with their templates.

Quote Reply
Re: template-based tree_mod! In reply to
Brad,

Thanks for the info, I will update the code on the page. I have been doing other things, not spending so much time in the Links area, but will try to keep it current. Thanks!

Leonard
http://southernarizona.com
Quote Reply
Re: template-based tree_mod! In reply to
That's cool. Figuring these things out together is what make the forum work!

I came up with something else. I am using the @ catagory pointers mod (one category pointing at another) posted at:

http://gossamer-threads.com/perl/forum/showflat.pl?Cat=&Board=L2Cust&Number=34455&page=&view=&sb=&vc=1

The map build was finding and showing the @ categories with 0 links, and the link was invalid (404) because the directory didn't actually exist.

If you use the @ mod, add this super easy change to remove pointer cats from the map page (the real category will still be listed where it belongs):

In site_html_templates.pl, sub site_html_print_map:

Find:
next CATEGORY if ($cat =~ /^\s*$/); # How'd that get in here? =)

Add this right under it:
next CATEGORY if ($cat =~ "@"); #Prevents Categories with the @ symbol from being listed

That's all there is to it!

Note that this applies to the mod posted in the thread I gave, not the Widgetz version referenced from there (I've never looked at that version and don't know how it works). However, if you use Widgetz version and have the same problem, you can probably do something similar.