Archive for 6th October 2007

A Simple Link Rewriting Script In PHP

Recently asked in Yahoo! Answers:

Javascript using var to enter domains?
My work uses this great code at the top their page….

Then in the HTML code the following is put to make it work:

When the page loads and the user views it it reads: src=" http://blah.images.com /lp/blahblah.jpg"

It automatically puts the domain information in case you need to change it. In my case, I'd like all items to point to ".com/future/" then when I'm done with the new site simply change that original java script to remove the "future" and push the testing site live. My company uses .pd files…but that shouldn't make a difference. I've analyzed all the code and can't make it work on my site, doesn’t look like I’m missing anything. Suggestions? Or maybe a different way to do this? I'm using .php for my site. Thanks!

Actually, this is an example of it making more sense to use a server-side scripting language rather than JavaScript. The client needs to enable JavaScript; if he hasn’t enabled it, the links won’t be updated. PHP ensures we get good links.

So, let’s do this. No code to download this time; you’ll need to pay attention and copy and paste properly from the code here.

Continue reading ‘A Simple Link Rewriting Script In PHP’ »