theniteowl
Programmer
Hi All,
I have a web page template I created and I pass a value to the page to tell it what HTML file to load into the main content section of the page.
I need to be able to analyze and alter the links in the page that I include.
The reason for this is that the templated system will always remain the same and the HTML pages the client creates will load inside that page structure. Links inside that page need to be formatted so that they can pass values to the next page telling it what state the navigation menu is in and the relative folder path for the file to load.
Rather than requiring the clients to specially formulate all of their links so that the menu system is not affected I want to dynamically alter the link when the page loads.
I would analyze the link to see if it is a relative link or a fully justified one (presumably one that is linking to an extrnal web site) so that only links to local pages will be altered for the menu but links to external pages I could make certain open in a new browser window.
Help?
Currently the system works like this.
<A HREF="<?= $linkurl ?>mylink">My Link</a>
The $linkurl contains the path to the template file, values to set the navigation menu to the correct settings for the page and on the end is the name of the file the client wants to load without an extension. It is passed as a URL value and my script determines the path based on the menu selection then appends the .htm on the end.
This means the client has to add the <?= $linkurl ?> in to every HREF and they have to leave off the .htm. My goal was to make this a simpler system for them to maintain and it would be better to not require unusual mods to every page they make.
If I can alter the links dynamically then they can have a normal link in their page and I can handle the rest in script.
All pages are on the same server unless linking to an outside URL.
Thanks.
Stamp out, eliminate and abolish redundancy!
I have a web page template I created and I pass a value to the page to tell it what HTML file to load into the main content section of the page.
I need to be able to analyze and alter the links in the page that I include.
The reason for this is that the templated system will always remain the same and the HTML pages the client creates will load inside that page structure. Links inside that page need to be formatted so that they can pass values to the next page telling it what state the navigation menu is in and the relative folder path for the file to load.
Rather than requiring the clients to specially formulate all of their links so that the menu system is not affected I want to dynamically alter the link when the page loads.
I would analyze the link to see if it is a relative link or a fully justified one (presumably one that is linking to an extrnal web site) so that only links to local pages will be altered for the menu but links to external pages I could make certain open in a new browser window.
Help?
Currently the system works like this.
<A HREF="<?= $linkurl ?>mylink">My Link</a>
The $linkurl contains the path to the template file, values to set the navigation menu to the correct settings for the page and on the end is the name of the file the client wants to load without an extension. It is passed as a URL value and my script determines the path based on the menu selection then appends the .htm on the end.
This means the client has to add the <?= $linkurl ?> in to every HREF and they have to leave off the .htm. My goal was to make this a simpler system for them to maintain and it would be better to not require unusual mods to every page they make.
If I can alter the links dynamically then they can have a normal link in their page and I can handle the rest in script.
All pages are on the same server unless linking to an outside URL.
Thanks.
Stamp out, eliminate and abolish redundancy!