Gossamer Forum
Home : Products : Gossamer Links : Discussions :

different headers for different cat

Quote Reply
different headers for different cat
How to say to links sql :

if category id=1 include header 1

if category id=2 include header 2

if category id=3 include header 3

......

Any hint please

Antoine
Quote Reply
Re: [antoined] different headers for different cat In reply to
Something like this should work;

Code:
<%if ID == 1%>
<%include file.html%>
<%elsif ID == 2%>
<%include file2.html%>
<%elsif ID == 3%>
<%include file3.html%>
<%elsif ID == 4%>
<%include file4.html%>
<%elsif ID == 5%>
<%include file5.html%>
<%else%>
<%include file5.html%>
<%endif%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different headers for different cat In reply to
Thanks Andy for this, but not working yet.

Is "ID == number" for a category ???

Thanks

Antoine
Quote Reply
Re: [antoined] different headers for different cat In reply to
I can't remember if it is ID or CatID. Do a <%GT::Template::dump%> call in the cateogry.html template, to see what tags are available, and what holds the categories ID.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] different headers for different cat In reply to
Thank you i learned something new "dump". It is category_id

Antoine
Quote Reply
Re: [antoined] different headers for different cat In reply to
Antoine:

Why not use the already inbuilt header feature in the categories?

That way you can just use the <%header%> tag.

Regards,



Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Different Content Type headers for different cats In reply to
When I did read the subject I thought it's about the header content type, to have changeable for each category. Maybe this is offtopic here, but in case that somebody misunderstood the topic like me, I post it here.

IMO, it would be good idea, to have the Content-Type header changeable by category. This would make possible to even have categories using HTML, WML, XML, etc. languages, making LinksSQL very flexible in aspect of new internet technologies support.

Tough I didn't check core code from this aspect, but IMO would be not very difficult change. Mainly depends on GT decision. Just a new column in Category table, and some changes in core LSQL code.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Different Content Type headers for different cats In reply to
This is an interesting concept.

But, if you use template sets, then you can change the content header line for each category. This is probably a better/safer way to go anyway. If you need a different content headers, you probably need different templates as well.

As for changing links, it should only be a change in the "print cat" routine(s), where the category data is obtained. You need to assign the input database record to the output record, as is done for the other fields. This is "legacy" code, and logic, and has caused some problems in the past, since "assumed" fields are not passed through, as is done with the Links record.

Hmmm... suddenly got non-trivial, perhaps. Links uses a modified CGI.pm to handle I/O, and that uses an intelligent ->headers routine, that only sets headers once. You'd need to be able to replace that, in the code, at the appropriate areas, something like:

($cat->{content_header} ) && $IN->header($cat->{content_header})

That might require significant logic changes, to know where categories are printed out, and if a link is in a certain category, etc.

This couldn't be done in the templates, unless new content header lines override the old ones (I don't know enough about browsers, and protocols to answer that one).

If you could override the content header in the templates, than ignore the past few paragraphs, and after changing the print cat routines to pass through the content_header field, you would put:

<%if content_header%><%content_header%><%endif%>

at the very top of any "page" template (not included template) and it should work.

The WC3 has a list of ways to set content encoding using meta or xml tags. these probably override the default CGI.pm content-headers as they occur within the document context:

http://www.w3.org/...ional/O-charset.html

Might be a start.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Different Content Type headers for different cats In reply to
Quote:
If you need a different content headers, you probably need different templates as well.
At first sight it seems logical what you say, but I'm not sure, there are no exceptions, where having the content_type info stored for each category in db would be useful.


Quote:
If you could override the content header in the templates, than ignore the past few paragraphs, and after changing the print cat routines to pass through the content_header field, you would put:
<%if content_header%><%content_header%><%endif%>
Even if it would possible, I would not vote for that solution. Security reasons. Header printing must be done within core code, anyway, without ability that en editor would be able to add any header content.


Anyway, as I checked the core codes, it seems it would be a much difficulter task than it seems at the first sight. Would likely need program flow logic change. Also there are many html codes hardcoded into the core codes. So however it seems possible, it is an NOT easy task. Also plugin solution seems possible, but only by replacing many original codes.

Let me list some info, ideas, links about the subject.

New column in Category table:
  • Content_Type

    I think a hierarchical inherited/overrideable content type structure would be the best.

    So content type hierarchy should be:
  • Config Content_Type value => level 1
  • Template set global value of Content_Type => level 2
  • Category dependent Content_Type value => level 3

    The existent value of a higher level overrides value of lower levels.

    Default value would be value of Content_Type in Config: text/html.
    Template set may have Content_Type global value defined, so it overrides the Content_Type Config value.
    If the Content_Type column in Category table has value, it overrides the Content_Type Config default value & the Content_Type value inherited from Template set.

    Quote:
    The WC3 has a list of ways to set content encoding using meta or xml tags. these probably override the default CGI.pm content-headers as they occur within the document context:

    http://www.w3.org/International/O-charset.html
    No, this is about character sets.
    The content type is different. It is added by the webserver, or dynamically by the cgi scripts.
    On Apache use the AddType directive:
    http://httpd.apache.org/...od_mime.html#addtype


    Some links about Apache, Perl, WML related & configuration info I found useful:
    1. Short Common Mime Type list
    2. Long List of Common Mime Types
    3. WAP-server configuration info
    4. WAP-server configuration example
    5. Building WAP-pages using Perl
    6. Article about Configuring Apache for Wireless Browsers (with examples)
    7. Serving WML contents
    8. How can I use Perl to make WML contents more dynamic
    9. HTTP server MIME types for WAP



    Example code (idea):
    Code:
    # pre-read the globals
    $Links::GLOBALS ||= GT::Config->load (
    "$CFG->{admin_root_path}/templates/$template_set/globals.txt",
    { inheritance => 1, compile_subs => 'Links', local => 1, cache => 1 });
    # set the correct header
    # get default value from config
    my $header = $CFG->{Content_Type};
    # override from Template global if defined
    $header = $Links::GLOBALS->{Content_Type} || $header;
    # override from Category db if defined
    $header = $cat_db->{Content_Type} || $header;
    # print the header
    print $IN->header({ -type => $header });

    A problem is, that in original code, these variable contents are available at different code levels. Global is only loaded in user_page(), db content is first queried in build_category(). But the headers are printed at generate_category_page(), before anything happened. IMO, the header printing should be delayed at least until the build_category().

    Also we need to split the development task into 2 parts:
  • dynamic solution (we generate the header, according to template, category db, or config settings)
  • static solution (this needs different approach, since it needs to generate the files with different extension, e.g. .WML, then the server is displaying with the appropiate header according the extension)

    Further comments, ideas are welcome.

    P.S.: Should this discussion move into a separate thread?

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
  • Quote Reply
    Re: [Clint] different headers for different cat In reply to
    Hi Clint,

    I am now using <%header%> tag to customize the header of each category, and to let each category have its own different header.

    Now the detailed page (which is not generated through category.html) is not accepting <%header%> tag, so how to place in the detailed page the same header of its related link placed in links.html ?

    Since I have many categories and subcategories, placing <%include include_header.html%> won't allow me to have different headers for different detailed page.

    Let us say that i have 40 categories and each must have its own header different from the others.
    <%header%> will work for links.html and for the detailed.html ????

    Any hint please.
    Thanks

    Antoine

    Quote Reply
    Re: [pugdog] Different Content Type headers for different cats In reply to
    Might be good idea, to bring this concept again into attention of LSQL developers...

    Alex, GT Staff,
    Could you support this concept, and build it into LSQL?
    This would make LSQL really flexible product, where different content headers (i.e. for WAP pages), could be mixed in each category.


    I could be satisfied with templates, which could be able to output different content-headers, so could be able to create WAP templates.

    Either solution would be acceptable for me...


    Opinion?

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...