Gossamer Forum
Home : Products : Links 2.0 : Customization :

Relativ link in templates

Quote Reply
Relativ link in templates
Hi

i wish to include a 'relativ link' in the categories and subcategories pages.

in 'categorie/' folder i wish this to be printed in the category page:

<!--#exec cgi="../cgi-bin/random/news.pl"-->

in 'categorie/subcategory' folder i wish this to be printed in the subcategory page :

<!--#exec cgi="../../cgi-bin/random/news.pl"-->

is there a way to get it ?



or let s say :

Is there a way to get printed the relativ path in the 'category template'

for ex :

In the

if in 'category_name_field' = '/'

print '../'



then i can get my relativ adress in the category template like, it would then be built correctly in the 'category/' and the 'category/subcategory/' respectiv index files.

<!--#exec cgi="<%relativpath%>cgi-bin/random/news.pl"-->



i wish it is understandable and that you know a way to do that. Crazy
Quote Reply
Re: [jigme] Relativ link in templates In reply to
Don't know why you need to use relative paths in your SSI directive since it should work like the following:

<!--exec cgi="/cgi-bin/news.pl"-->

But if it doesn't, then you can create a global (tag) called "relative_path" via the following steps:

1) In the links.cfg file, add the following variable:

Quote:

relative_path = "../";


2) Then in your site_html_templates.pl file, in the %global hash section, add the following codes:

relative_path => $relative_path

3) Then in your category.html file, you can use the following codes:

<!--exec cgi="<%relative_path%>news/news.pl"-->

BTW: There may be an easier solution, by creating a global for your news script...codes have been posted before...search for banner or header footer.

Good luck!
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Relativ link in templates In reply to
In Reply To:
i requested you help because the cgi script can be executed only with relativ path. The following does not work <!--exec cgi="http://www.mysite/cgi-bin/news.pl"--> it works fine if i put in 'home.html' (root level) <!--exec cgi="/cgi-bin/news.pl"--> it works fine if i put in 'category.html' (firstlevel) <!--exec cgi="../cgi-bin/news.pl"--> but it obviuously does not work for 'sub category' pages (secund or further level) it should be printed in the 'category.html' <!--exec cgi="../../cgi-bin/news.pl"--> or <!--exec cgi="../../../cgi-bin/news.pl"--> according to which level of category page is edited.

Your explanations will give me such results which does not work in the category pages

<!--exec cgi="http://www.mysite/cgi-bin/news.pl"-->



if there is no way for automatic recognition of the level

i suggested that maybe, Links can do something like

IF in field 'Category name' there is '/', then print '../'

or IF IF in field 'Category name' there is '/' and another '/', then print '../../'



then for sure i will have the relativ path printed through the 'category' page.



but is Links2 abble to recognize the presence one or two caracters (/) in the 'category name' field.

tanx if you can help

Wink



(the return to line did not work in this message beginning, sorry, it might be hard to read)
Quote Reply
Re: [Stealth] Relativ link in templates In reply to
ok

very sorry

it simply works i don t know how

the code

<!--#exec cgi="/cgi-bin/news/news.pl"-->

in category.html

works in any level of the categories

sorry for using yoour time due to my ignorance



cheers



j