Click to See Complete Forum and Search --> : Variables from a text file


Davehead
09-26-2005, 05:15 AM
Hi all.
I am not sure if you could use JS for what I am trying to acheive but here goes.
I have a site that has a variety of different categories. I would like a series of category-relative links to be displayed depending on which category the

user is on.
Would it be possible, to define these links in a text file, and then, in my template use some sort of if statements to check what category is bein viewed,

thus display those pre-defined links on the page.
So, a very crude (and probably incorrect)example would be:

External text file:

var internetLinks = array('<a href=http://www.google.com>Link 1</a> | <a href=http://www.google.com>Link 2</a> | <a href=http://www.google.com>Link 3</a>');

Code in template:

<script language="JavaScript">

if (location.href = 'http://www.getcheaper.co.uk/products/Internet+connection/')
{
document.write(internetLinks array from external text file)
}
</script>

So it would kind of be like external text files in flash???

Like I said, probably horriibly wrong, but its purely for explanation.
Cheers
D

Fang
09-26-2005, 08:57 AM
This is best done server-side with server-side includes or PHP include.