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

Additional fields in the table category?

Quote Reply
Additional fields in the table category?
Hi!

I've just added an additional field into the table category - and thought i could include it via <%variable_name%> into the template category.html - why do i get an "Unkown Tag" - error?

Thanx for hints!
Chef


Quote Reply
Re: Additional fields in the table category? In reply to
It is not that easy with Links SQL. You have to
define the tag in the sub build_category_pages in
the nph-build.cgi script.

Look for the following set of codes:

Code:

# Get the category info.
%OUT = (); # Start with a clean hash.
$OUT{category_id} = $category_r->{'ID'};
$OUT{category_name} = $category_r->{'Name'};
$OUT{header} = $category_r->{'Header'};
$OUT{footer} = $category_r->{'Footer'};
$OUT{meta_name} = $category_r->{'Meta_Description'};
$OUT{meta_keywords} = $category_r->{'Meta_Keywords'};
$OUT{description} = $category_r->{'Description'};
$OUT{random} = rand (10000);
$OUT{random1} = rand (10000);
$OUT{random2} = rand (10000);
$OUT{random3} = rand (10000);


You will need to add something like:

Code:

$OUT{newfield_name} = $category_r->{'Fieldname'};


Then you can use <%newfield_name%> in your category.html
template file.

Regards,

Eliot

Quote Reply
Re: Additional fields in the table category? In reply to
With your hint it was easy, Eliot.

Thanx a lot!
Regards,
Chef

Quote Reply
Re: Additional fields in the table category? In reply to
You're welcome.

Regards,

Eliot Lee

Quote Reply
Re: Additional fields in the table category? In reply to
Hi,

..and don't forget to change the code in page.cgi if you need the tags dynamic.

regards, alexander

Quote Reply
Re: Additional fields in the table category? In reply to
Hi Alex,

i'm just switching from Links 2.0 to SQL: Could you or anyone else give me a hint how to use page.cgi? I've no idea right now ...

Regards,
Chef

Quote Reply
Re: Additional fields in the table category? In reply to
Hi,

Links SQL has 2 ways of displaying a page.

1. Static:
The pages are built with admin via nph-build.cgi. When a user clicks on a category he will see the static html page which will not change until you build the pages again.

2. Dynamic
the pages are built every time a user clicks on a category, requests the detailed page or the other pages. Page.cgi builds all these pages depending on the parameters it gets in realtime.

Hope it helps, alexander

Quote Reply
Re: Additional fields in the table category? In reply to
Hi Alex,

thanks for your reply - just another question:

Is it possible to call page.cgi and using a different template as normal?

I'm creating static detailed pages and thinking about calling page.cgi from there for a clean printable page - what do you think?

Regards
Chef

Quote Reply
Re: Additional fields in the table category? In reply to
Hi,

shure, I did it the following way. In HTML_Templates.pm I inserted a sub which accepts a template as a parameter and called it sub build_static_page_html.

Page.cgi and nph_build.cgi calls this sub to build the pages I want with the different templates.

My problem is more the specs how to make html pages printable than the perl programming.

regards, alexander