Web programming >> Help needed with a small script please
Posted by bainsk8 on 11:31:00 02-18-2002
Im building a site and I want to put all my links urls in a single file in my cgi-bin. So that if I need to change the path of a broken link I can by changing the url in this one file. This would save me alot of time without changing the html link in every page. I only know html and have tried other langages but find it hard if someone could show me a script that would be of use or point me in the right direction I would be very pleased as it is the main thing holding me up on publishing the site.

Thanks in advance with this one.


bainsk8
Posted by sacah on 12:44:00 02-18-2002
I find the easiest for this kinda stuff is make a file called links.js , in it put
document.write("<font size='4'><a href='index.htm'>Home</a><br><br><a href='members.htm'>Members of LOL</a><br></font>");
just keep adding ur links, then in each HTML file just add
<script src="links.js"></script> whereever u want the links to appear.

Hope u understand this
(-:

[ This Message was edited by: sacah on 2002-02-18 12:45 ]
Posted by KaGez on 12:46:00 02-18-2002
with PHP&MySQL the whole story would get even easier
[addsig]
Posted by sacah on 12:57:00 02-18-2002
How many free hosts have MySQL, even PHP, Thats why i put the tech above, it works on all hosts.
Posted by bainsk8 on 14:06:00 02-18-2002
Thanx guys for the help. I am a bit reluctant to use java script as i know of people who have browsers that dont enable it. And I have a free host, all be it slow but they do except mySQL and PHP and I think that would be the way to go. I would like to thank you both for your intrest so far and please do keep helping me with this one.
Oh for anyone interested my web site host is http://www.portland.com

Thanx again

bainsk8
Posted by sacah on 00:38:00 02-19-2002
ok, I would not use MySQL for this one, make a file called link.lst in it put
<a href="link1.htm">Link1</a><br><a herf="link2.htm">Link2</a>

then in HTML file add
<?php $LinkFile = "link.lst"; $fp = fopen($LinkFile, "r+"); $tts = fgets($fp,filesize($LinkFile)+1); fclose($fp); print "$tts"; ?>

just add new links, etc to the link.lst file.

[ This Message was edited by: sacah on 2002-02-19 00:40 ]
Posted by nonama on 19:47:00 02-19-2002
dont you think that its a better choise:




?
Posted by bainsk8 on 22:29:00 02-19-2002
Thanx again, that clears it all up for me. I will use your code SACAH thank you, but I think it's about time I learnt some PHP so Im off to a php site for info, if anyone can recomend any sites or good resorces for php that would be a great help


bainsk8
Posted by sacah on 04:55:00 02-20-2002
sweet nonama, I did not know that one, ur one would be awesome for what bainsk8 wants to do
(-:
Um, links www.php.net
other cool way is goto www.google.com and search for
php+tutorial+beginner
stuff like that

hope that helped
Posted by bainsk8 on 16:42:00 02-20-2002
Thanks Guys great help.


All the best
Posted by bainsk8 on 16:43:00 02-20-2002
k [addsig]
Posted by bainsk8 on 16:52:00 02-20-2002




Posted by bainsk8 on 16:57:00 02-20-2002
hope this works just a tag i have been working on aswell [addsig]
Posted by Peter on 17:20:00 02-21-2002
You're reluctant to using javascript, but not to using a flash plugin? sounds like a s trange combination..
Posted by bainsk8 on 19:02:00 02-21-2002
I can see that it upsets people to use a flash signature and as i was only experimenting i will remove it. I think this is a good forum and it would be best to keep it that way


bainsk8