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

Multiple Category Templates?

(Page 2 of 2)
> >
Quote Reply
Re: Multiple Category Templates? In reply to
ok.. i just noticed that i forgot to update something in 1.11 when i switched over..

first go to Admin_HTML.pm and change

Code:
$templates = &get_template_list ($in, $db, $save_as);

to

Code:
$templates = &get_template_list ("edit_tpl", $save_as);

and then the get_template_list can be..

Code:
sub get_template_list {
# --------------------------------------------------------
# Returns a list of all the templates (select list).
#
my ($name, $default) = @_;
my (@tpls, $tpl, $output);

opendir (TPL, "$LINKS{admin_root_path}/templates") or die "Invalid template directory: $LINKS{admin_root_path}/templates. Reason: $!";
@tpls = grep {!/^\./} readdir TPL;
closedir (TPL);

$output = qq~<select name="$name"><option value="">----~;
foreach $tpl (sort @tpls) {
($default eq $tpl) ? ($output .= qq~<option value="$tpl" SELECTED>$tpl~) :
($output .= qq~<option value="$tpl">$tpl~);
}
$output .= "</select>";
return $output;
}

and the line in build_template_row

Code:
my $select = &get_template_list ($value, $name);

to

Code:
my $select = &get_template_list ($name, $value);

jerry

[This message has been edited by widgetz (edited January 11, 2000).]
Quote Reply
Re: Multiple Category Templates? In reply to
In reality, now that I (and Jerry) are more experienced with Links SQL, it wouldn't be too hard to do.

BUT... the new version of Links coming out proomises some additions that may make making these changes moot. For instance, if there is an advertising module, then the program will have to know more about where it is and what it is doing, which translates into easy picking a template as well.

If you can wait a week or two, let's see what the new version has.

If not, I'll probably release a multi-template mod as well as a multi-database mod to allow running different sections (such as classifieds and shopping) in sub-trees of links. I have a need to do that in a bad way, but I don't want to get into supporting a lot of add on code that may be built into links already.

For instance, if you have a links site, but one area is for listing businesses, you might want to have the businesses be able to enter shop information such as hours, services, personnel, etc, without making every record in the links/jump database huge. All you'd need to do is make an entry in a new database with the LinkID as key field, to store the new data. Of course it's a bit more complicated than that, but not much.

Let's see what Alex has in store for us in the next 2 weeks then start making the changes we need.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/









Quote Reply
Re: Multiple Category Templates? In reply to
Hi

Has anyone get this instructions to work? I really want to have different templates for differen categories!

Thanks.

Are
Quote Reply
Re: Multiple Category Templates? In reply to
I havenīt tested this mod, but it sounds good to give every cat all choices (same to link)
but i need some ohther thing:

Too reduce the work adding in every cat (or link) the right values for the new fields (template for cat, link, detail)
i would like to have only n templates for the n main-cats and for all sub-cats use the same template than for the main-cat.

So i need something like:

$var = "rexep everything till the first / from the value $category"


my $output = &load_template ( '$var.html', {

and add n templates named like my cats.

(or better for cats with spaces or &)

$var = "rexep everything till the first / or space or & from the value $category"

So what is this????

my ($name) = $tags->{'category_name'} =~ m,/?([^/]+)$,;


isnt it the right rexep???

So i could:
my $output = &load_template ( '$name.html', {

???

I will give it a try ...

Robert








> >