Forum Moderators: open
All of the printer friendly version pages have exactly the same name as the original with the word print_ before them.
e.g
contact.asp
print_contact.asp
I was wondering if there was a way that I could copy the same code into every file without having to keep changing the file name in the code.
Here is the code:
<a href="print_contact.asp" target="_blank">Printer friendly version</a>
Does anyone know how I can have a bit of code so that it gets the name of the current page. Something like
<a href="print_<current page name>.asp
Or something like that.
You would be saving me hours of work.
Thanks
Rich
A little Javascript...
document.writeln(document.URL);
A little PHP...
echo basename($_SERVER['PHP_SELF']);
You probally need a string replace, I'll try to play around with it but if someone knows how to do this without havnig to bend over backwards go for it.
Thanks, but I am not worried about the printing part.
I am trying to open the printer friendly version in a new window.
I already have a printer freindly version for every page and the printer friendly version always has the same name as the page it is printing with print_ at the front.
So if my page is called About_us.asp
the printer freindly version is called print_About_us.asp.
I am trying to enter a bit of code that will somehow be able to get this name print_About_us.asp automatically. This will then svae me from haveing to change the link on every page and I can just search and replace all the files to enter the link.
Rich