Hi ok got a question for you here.
I’m working on a script at the moment and I have it working fine 'but' I would like to know if anyone knows of a better way it can be done?
What I have is a list of links that pass a value through to the next page when clicked such as
<?php
<a href="http://www.mysite.com/test.php?link=4">click here to display</a>
?>
now the next page is a template page with this code inserted in (this is only a snippet but it's the same over and over.)
<?php
if ( $link == "1" ) { include("test.txt"); }
elseif ( $link == "2" ) { include("test2.txt"); }
elseif ( $link == "3" ) { include("test3.txt"); }
elseif ( $link == "4" ) { include("test4.txt"); }
else ( print "Im sorry this page is not available, please try again later.");
?>
As you can see depending on what link they click it pulls the appropriate text file and displays it, but the variable query becomes over 300 lines long as the content I want to display has over 300 possibilities.
I have roughly 12 lists each with over 300 links to choose from. That’s 300 lines of code in 12 different pages.
Does anyone know of a more efficient way of doing this? Will it drastically slow down my pages if I do it this way? or will the speed, in which it checks and loads the file, be negligible?
Cheers in advance
Zak