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

Different category template for different category

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
Quote Reply
Re: Different category template for different category In reply to
Evoir,

When I first started with Links SQL, I was overwhelmed. Links SQL is a very powerful and versatile program. Both these aspects of Link SQL mean learning something new.

I agree with Pugdog that comparing Links SQL with a BB program is like comparing apples & oranges. I also think that an SQL based link script should be though of more like a CAD/CAM program. They are both very powerful, will take some time to learn and will reward you in production later.

In customizing the look and feel of the program, I started by choosing the template set that I liked best. Then I went in and customized the text messages, colors, graphics and so on.

Then I hit a point where I needed to start using the tags and if/then/end (loops?) statements in the html files. Once I saw a couple of examples, some of the earlier messages I saw made a more sense and I realize this is not impossibly hard or lengthy learning curve as I originally thought.

One other thing, you mention purchasing Links SQL for a client. So for whatever reason asp or hand coded pages where not thought to be the solution. Evidently, you examined and discarded bulletin boards, image galleries, content & news management systems and focus on links programs, specifically Links SQL. I would guess Links SQL is still your best solution.

My suggestion would be to explain fully what you are trying to accomplish with Links SQL and how you were thinking about doing it. Once people understand your purpose, the explanations might better fit your needs.
--
Rob Van Deren


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

Thanks for your thoughtful reply as well!

Yes, we chose LinksSQL to run our content on our site becasue it came so highly recommended. We will be using it as a content management system. I spoke to Alex a few times on the phone (heck, it was impressive to actually speak with the programmer) and after many questions on the board, shelled out the $450 bucks. It has now been like 5 weeks and I am a bit closer to what I want, but I lack the knowlege of cgi and stuff to do what I want.

I just feel stuck behind this tech stuff that I don't understand.

I built my clients site completely by myself. We have a bulletin board (UBB swicthing to VB as we speak) and polls and newsletters and static html. It has grown beyond my desire to keep building static html pages. I want the editors of the magazine to be able to update content and images on their own. I am tired of having to copy edit while building pages. I'd liek to put it in their laps.

I am close to making this happen. I have installed Detailed Pages (thanks pugdog) and need to purchase and install image upload. But, I can't figure out how to have different category styles for different categories. this seems really important and basic to even a links program.

anyway. I'll be working on the site again and will spend yet another day trying to figure this all out.

I really do appreciate the encouraging words.

Quote Reply
Re: Different category template for different category In reply to
For me, one of the more confusing things about Links SQL is reading posts with bits of code like:

<%if URL eq 'http://'%>
link to detail.html
<%else%>
use link to website
<%endif%>

First, I had no idea where this was inserted. With the <%something%> tags means they are Links SQL tags that are inserted in html or txt files included in html files. They can be inserted almost anywhere, with the constraint the particular tag has to be available in that module.

Usually these code fragments are seen without a lot of explanation to the logic, so they are hard to understand and learn.

Pugdog's post was particularly helpful:

http://gossamer-threads.com/p/142429

It goes through several simple examples with enough explanation that a person can understand the logic of what is happening and see how it could be applied to different things. It also gives a person an understanding of how powerful and customizable Links SQL is. The ability to customize Links SQL goes way beyond most programs ability to select colors, determine placement and turn on/off features.

Anyway, as a novice, I too struggle with the complexities of Links SQL. What Links SQL will/can do far exceeds my abilities, and that is good. It is no fun to try and force a program to do something it really isn't capable of doing.

Hang in there!
--Rob Van Deren
BeaverheadRiver.com

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

Thanks for the comments! One of the things I like best about Links SQL is the ability to customize it. It has been designed from the ground up to be easily alterted to suit any task. Now when I say easily, I do mean easily to someone familiar with the program. ;) I am well aware that to a novice, the customizations can seem a bit daunting. However, with the plugin system and the templates, there is really very little reason to go into the code. Almost any changes can be made without altering the core code.

We are working hard on improving this. Our expanded user manual is coming along nicely (two chapters done).

I will be releasing an update tommorrow that will have the feature you are mentioning built in. It will let you pick either a template set, or a specific template per category. We are just doing some final testing on it now.

As for image uploads, we are also working on this. We plan to add simple uploads as a form type shortly (not for next release). This means you can go to the Database->Links->Properties, select Add Column, and then select form type => FILE, and now you can upload files for that column.

This will be available within 2 to 3 weeks.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Different category template for different category In reply to
Thank you Alex and everyone. Feeling a little better now. Happy that these changes are happening.

Thanks to everyone for explaining things a little more.

Quote Reply
Re: Different category template for different category In reply to
How do you do this?

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

it has been a bit more than 2 to 3 weeks. Is that image upload feature happening soon?


Thanks for your time,
-Evoir
Quote Reply
Re: Different category template for different category In reply to
In Reply To:
As for image uploads, we are also working on this. We plan to add simple uploads as a form type shortly (not for next release). This means you can go to the Database->Links->Properties, select Add Column, and then select form type => FILE, and now you can upload files for that column.
This is a general file upload field, from what I understand of how it's implemented.

You can flag a field as a "file" type, and that will point to a record in the "attachments" table, or whatever. It can be any sort of file, not just an image file, and each attachment you add to a link, must have it's own field in the link record -- so if you want two attachments per link, you need to add two "File" fields to that link.

If you need just an image attachment, either in the logo or the body of the link, my attachment mod is more complete in this respect. I have it working on several sites, have sold quite a few copies, but never get any feedback on it. Any changes/updates are non-user driven, without the feedback, but the module can be modified for specific uses. I'm thinking of adding in the "make thumbnail" feature, so that when someone uploads a logo that is too big, rather than generating an error, it makes the logo the right size.

The break up of the Image Gallery mod went well, and with about 10 minutes of debugging, it ran just like the pre-break up version, but now that it's in modules, adding/changing the logic will be easier -- adding "type checking" for other types, and such will be much easier. I may finally have a demo out to show what it can do.



PUGDOG® Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: [Alex] Different category template for different category In reply to
Trying to follow all the threads about Multiple Category Templates.

Has the 2.1.0 script been updated to reflect code changes above?

Thanks, April

P.S. Here is some more information on the problem from an e-mail to support. I'm unable to make the script recognize the use of specific category templates for some categories. I'll try to be as concise as possible. Things I've tried: -----I've put "category-Indianapolis-Visit.html" template using "trail&error' in: av (the template I'm using a default) default directories (both under the main directory and under "local") -----I've indicated at the bottom of the "Database" page for the category . . . Category Template - I've done "trial&error" on av, default and blank HTML Template - category-Indianapolis-Visit.html -----If I replace the "category.html" file with "category-Indianapolis-Visit.html" in the default template directory . . . it does use "category-Indianapolis-Visit.html ... but I have more than one category template I'd like to use. For example, category-Indianapolis-singles.html, etc., etc.
A. Lougheed
IndyLinks.com
webmaster@indylinks.com