PHP and HTML within echo?
Posted 15 June 2006 - 09:10 AM
So is it possible to copy the link data and put it into a variable (eg $links) and then echo this on my pages to save me time (also this would mean I only have to update the code once rather than on each page).
I could simply then have include and echo the $link - but can you echo HTML and PHP?
I tried but it never worked, anyone know of a way?
Posted 15 June 2006 - 09:29 AM
<?php include 'links.html'; ?>And your links will appear where ever you place the include.
Therefore you can just edit the links.html file to edit your links or to add in links and it'll be reflected instantly throughout your site.
Posted 15 June 2006 - 11:19 AM
I'm trying to avoid using frames if possible
Posted 15 June 2006 - 11:40 AM
<a href="index.php">Home</a><br /> <a href="tutorials.php">Tutorials</a><br /> <a href="porfolio.pgp">Portfolio</a><br /> .. more links here ..Now in your page you do this:
<?php //some code here include 'links.html'; ?>Now when PHP goes to parse your code it'll basically get the contents of links.html and copy 'n' paste it where include was stated
No need for frames or anythink! Just try it out.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users