Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Different category template for different category

(Page 1 of 2)
> >
Quote Reply
Different category template for different category
We plan to use linksql for yellow pages listing and make it for 13 categories for 13 states(each state with different template designed) for our country.
For each states addressing method we either want the address to be place it like (state1.yellowpages.com) or (yellowpages.com/state1).

And there are also an INDEX from A to Z for each states;
(State1.Yellowpages.com/index/level-1) or (Yellowapges.com/state1/index/level-1)

And to make it totally different in design for each states: (each state will have special design and things to put in) yellowpages.com/state1(yellowages.com/category1),we don’t know whether to use 13 copies of link OR only one,If we use ONE install there is a problem and maybe impossible to have different look for each states (category).

Is ther any suggestion? Will the next version as Alex mentioned about can solve this problem?

Thanks

Kelvin
kelvin74@hotmail.com


Quote Reply
Re: Different category template for different category In reply to
Multiple Category Templates are not a problem...you can port codes used in earlier versions to the recent version of Links SQL.

Regards,

Eliot Lee
Quote Reply
Re: Different category template for different category In reply to
Hi,

You can use custom header and footers per category. Also, with version 2.0.2, you can use a different template for each category.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
What if we take it one step further: apply the template of a specific category to all of its subcategories, unless that subcategory itself uses a customized template.

Example: We have category A/ using the default template; category A/B/ with a modified template, and hence all categories under it (A/B/C, A/B/D. etc.) using the same template. However, there is a A/B/M which itself has a customized template, that it (together with its subcategories) uses. Or, there is a a category A/B/C/N/ that has its own template (remember that A/B/C has inherited the A/B template) that it uses together with its own subcategories (A/B/C/D/N/O), sub-subcategories, and so on. In other words, categories inherit their parent's (or parent's parent) template, unless specified otherwise.

Is this already available or feasible to attain with rather decent programming skills?

Sorry if my post is not crystal clear - I'm not a native English speaker.

Quote Reply
Re: Different category template for different category In reply to
Hi,

Yes, with 2.0.2 this is already possible. The categories inherit the template settings of their parents, or use 'category.html' if not specified.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
"The categories inherit the template settings of their parents, or use 'category.html' if not specified."

Could you elaborate on that? What do you mean by a "template"? I've played with the demo on your site, and it seems I can customize a header and footer. Are these header and footer the only means to modify a category's template? Since saving a heder/footer feature is disabled in the demo, I couldn't see how it works.

It is my understanding that a modyfied template is something that overrides the default category.html, not just ads to it, as (it seems) is the case with the header/footer fields? Have I missed something in the demo?

Quote Reply
Re: Different category template for different category In reply to
Hi,

Yes, the demo doesn't have this enabled. To use a completely different template instead of just a custom header/footer, then you:

1. Add a field to the category table called CategoryTemplate.
2. Enter in the name of the template to use for that category. That category, and all subcategories will use the template you specify.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
Hi,
I implemented the steps alex gave us, but I am not getting any results. I added CategoryTemplate field and added a custom category template (html file). I did a re-build of the tables and did a build all several time and it defaulted to the orginal category template each time. I am currently running LinkSQL 2.0.3.

Anybody got this to work yet? If you did, could you send me the steps you follwed?

Thanks,
Odin

Quote Reply
Re: Different category template for different category In reply to
I'm really sorry. I distinctly remember writing this code, but now I can't find it in our source control, our in any existing version. Ugh!

Please replace site_html_category in Links/SiteHTML.pm with:

Code:
sub site_html_category {
# --------------------------------------------------------
# Return parsed category page.
#
my $tags = shift;

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

# Find the proper template.
my $template = 'category.html';
my $cat_db = $DB->table('Category');
if ($cat_db->cols->{'CategoryTemplate'}) {
if ($tags->{CategoryTemplate}) {
$template = $tags->{CategoryTemplate};
}
else {
my $parents = $cat_db->parents ($tags->{ID});
foreach my $parent (@$parents) {
my $cat_info = $cat_db->get($parent);
if ($cat_info->{CategoryTemplate}) {
$template = $cat_info->{CategoryTemplate};
last;
}
}
}
}
my $output = Links::load_template ($template, $tags, { dynamic => 1 });
return $output;
}
and it should work as expected. Again, I'm sorry about the mixup.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
Alex,
Thanks, it works like a charm... I know you guys are super busy.. But what do I need to change so that I can apply this to the subcategory and links fields as well?

Thanks for everything,
Odin

Quote Reply
different layout for 'subcategory-lists' In reply to
Hi,

odins question is about the same issue I'm wondering about. We have different categories with different layouts, each of them holds some subcategories. The display of the list of subcategories seems to be formated by subcategory.html, which is a global template. So how do I get different layouts for this list, to have it fit to the layout of the specific categorie they are in? The same goes for the Links themselves, formated by links.html. How to include category-specific ones?

I know this all should be posted in the Links SQL Discussions, but since it fits to the topic here ...

Thanks for all, especially for Alex's quick response to all this questions.



Quote Reply
Re: Different category template for different category In reply to
Hi,

Do you mean a custom template for the subcategory.html and link.html table? Hmm, subcategory.html would be very similiar to the mod abvoe, but link.html would be quite difficult.

I think with the next release, I'm going to switch to loops, it will make things much easier to change. This should be by end of next week.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
Hi:

I added the above code, and it did work fine. But since the default directory is already so full, I wanted to but the special category pages in a subdirectory (if only so it would look neater...)

Anyway, I made templates/default/cats the repository for the modified category templates, and I have tried a bunch of different ways to call the templates in that subdirectory from the CategoryTemplates field, none of which work. I tried:

cats/template.html
/cats/template.html
http://www.full.path.to/templates/default/cats/template.html

all of which give me an "A fatal error has occured:

Invalid template name: cats/columbia.html" error

Any ideas?

dave

Quote Reply
Re: Different category template for different category In reply to
Hi,

It won't be trivial to do this. Your best bet would to just make sure you prefix your category names 'header_Categoryname' for example.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
Alex:

Thanks- if it is a big deal, well, I will skip it no problem!

However, I am having a different, weird problem. First, I noticed I was not getting the page I was using to go "down" the chain- that is, into the child directories. Then, as I played more, I found that it was in fact going up the categorys! That is, if I did say:

WarnerBros/Shorts

with a different category, I would expect it to show up in:

WarnerBros/Shorts/Looney Tunes

(Right?)

Well, it was actually showing up in

WarnerBros/Shorts

AND

WarnerBros

Is that a code problem, or do I ave major problems in my Category DataBase?

(If you want to see it, I will have to do it for you- as soon as I noticed it, I took steps so it would NOT happen....)

dave

Quote Reply
Re: Different category template for different category In reply to
Code above has been modified. Sorry about that, not sure what I was thinking.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
Thank you Alex,

It works, but getting minor error “There are Unknown Tag: 'grand_total' links for you to choose from”
I have YahooSubcats installed

How to fix it ?


Quote Reply
Re: Different category template for different category In reply to
Can someone spell this out for me?

I would like to have different category pages per category, and I would also like the detailed page to follow suit as well. So, the detailed page would have different detailed page per category. SI this possible?

Do I need to change the code as alex suggested above, or has that been fixed in the product?

Why can't this simply be in the Browse button, where you say which style goes with which category? Would be much simpler. Then you could have different style sets and simply point and click.

anyway, if someone could tell me exactly how I would have different category pages for different categories...spell it out like I am a moron, I'd appreciate it. :) Also, if there can be diffenernt detailed pages per category...can you spell that out too?



Quote Reply
Re: Different category template for different category In reply to
Actually, it might be possible to expand the "category.html" idea, to be a template set.

A few changes in the core links logic would have to be made, but basically it would follow the same idea:

use default template set
load current category
if current category has overriding template set, use that
if no overriding template, check parent. [loop until 'root']
use most currently selected set

If you have deep categories, this has a performance penalty.

To improve performance, one of two things could be done. A separate "templates" table could be maintained, such that only one lookup was done for each category, but this look up was done each and every time, so you loose the "speed" of having the default template in the Category record itself (but you have a spiffy little editor to quickly update the template sets for the category table, so it might be a good trade off), _or_ you have a routine such that when you set a "parent" category to have a different template, a routine automatically adjusts all the chidren to use the same template. This keeps the speed of having the template set kept in the current category record, at the expense of having to make sure every category had the non-default template set (ie: no relational inheretence from the parent). Two options would be needed to be available on such an update:
1) - update _all_ children
2) - update all children with no overriding template already set
(or, with a template set matching the current override being changed)
3) - update only this category

Of course, for convenience, additional options to modify the "update" statement could be added, but those are the basics.

Sounds sort of complicated, but actually, depending on the next release, it might be fairly simple to implement as a "standard" option in the subsequent release.




PUGDOG® Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Different category template for different category In reply to
Thanks pugdog,

but.... why is everything in LinksSQL so difficult? :)

I was hoping for a simple answer.

It just maes sense to be able to have different styles per category, doesn't it? Is there some way I can do this out of the box, or do I have to hack it in?

Quote Reply
Re: Different category template for different category In reply to
Code:

but.... why is everything in LinksSQL so difficult? :)


Difficult? Ha! Compare it with other SQL based Perl applications and, of course, faulty flat file systems and you will see that it is a lot more easier to configure!

Regards,

Eliot Lee
Quote Reply
Re: Different category template for different category In reply to
Eloit, I did put a simlie face in there.

Why shouldn't it strive to be made even easier. I mean, vbulletin is a database application, and it costs half as much and has 10 times the amount of customizations without having to get into the code. I am comparing it to vbulletin.

It seems like LinksSQL you need to know stuff about cgi in order to have it do anything other than run like a yahoo directory.

I mean, customizing different categories should come as a stcok feature, no? Why would I have to hack something in order to do that?

And Eloit, I know you don't like what I have to say about links. But the fact is that I bought it for $450 and I am trying to work with it, and it is prooving to be more complicated than I'd like.

And I have heard this elsewhere on the support forums by others in PM as well as in public. It seems as though it is a technically challenging program for folks who don't know about databases or loops or cgi and stuff. Yeah, I have it installed, and I have finally got the detailed pages up, and haven't yet paid for the image upload from pugdog (why isn't THAT a standard feature?) and I keep coming across these things that need customizations... it sorta stinks.

so, yes. it is complicated, but I am open to making it work. In fact, very motivated to make it work (because we paid for it. but it is not nearly as eay to use as vbulletin or even UBB. IMHO.

I would rather solve my problem with styles per catagory than debate this further with you.

Quote Reply
Re: Different category template for different category In reply to
The reasons are legion.

vBulletin is doing one "simple" thing, which can almost be emulated in Links SQL with just a bit of effort (several people have make interesting hacks to that effect).

When Links was _just_ a links program, it was simpler. But, people wanted a content management system, a links system, a classifieds system, etc.... Heck, I'm using it for a postcards greetings site, and have a image/graphics stock-photo agency sort of system in the works.

Links SQL 1.x was an attempt to allow the flat file system to grow and expand by using the power of SQL to overcome the limitations of flat-file locking and resource usage.

Links SQL 2.x is something far beyond that. THere are modules and parts that allow an almost infinite expansion (of course, someone has to write that, but the capability is there!) within the same set of rules. It's sort of like an early version of an IDE (vbasic, turbo C++, etc) where everything is inside the environment, and you link to pieces via an interface.

If you really want to see what a complicated perl project is, without the organization and planning of something like Links, check out "minivend" which is now "Interchange" and which was just bought by RedHat for incorporation into their release.

Interchange looks good on the surface, but I've been following it for 2 years, and going beyond that is a nasty process. It's not organized, logical, or easy to modify or maintain. It's getting there, but it's following the same "growing pains" as Links, but Links has much better planning, implementation, and a much broader future! Heck, Links _can_ be a minivend/ecommerce package, but can they be a "links" ?? :)

With power comes a learning curve.

The installation is trivially simple now, upgrades and modifications via the plugins are trivial, and all you need to do is learn how to use the templates to really make changes. This separates the interface from the underlying implementation completely.

Small price to pay :)

With the next release that hopefully will clear up the use of "loops", most discussion can concentrate on how to develop the templates and "globals" to do what you need, without hacking into the code at all.

Virtually no other program out there can claim that! None!



PUGDOG® Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Different category template for different category In reply to
pugdog,

thanks for yourthoughtful reply. This is in fact why I bought Links. because I have heard so much about how well it was written. I don't write cgi or php or any language. I use applications that are written in these languages. :)

I want to use links as a content tool and I convinced my client who doesn't have a lot of money to buy Links for this purpose. Now, I am lookin mightly silly as I can't quite do what I thought I could do with it unless I learn a lot more about cgi and all. So, I am frustrated.

I am hopeful, however, which is why I keep posting here even when I don't seem to get the help I need. (I often get replies, but they don't seem to help me.) So....I want it to work....

When is the next relase coming out?

Quote Reply
Re: Different category template for different category In reply to
Alex posted that the next release would be out next week, and that it would be a bug fix, module fix, and have a better import/export set of routines, as well as a new default template set, which means it will probably explain the "loops" and other features more clearly.

PUGDOG® Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
> >