Php Help?!

liunx

Guest
i remember <acronym title='Server Side Includes'>SSI </acronym> could load in an external file, so you could say tell it to<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><!--#include file=/web design/navigation.html" --><!--c2--></div><!--ec2--><br /><br />and it would include the navigation bar in your page, advantages of this were if you needed to add something at a later date you could do this changing one file not many, it was also good for say footers where © 2006 would need to be 2007 soon.<br /><br />anyways, how do i do this in php, i tried a code, it worked but none of the images worked.<br /><br />if it helps im making these using slices from imageready and putting nav.php in a frame<br /><br />the code i used (and i think its wrong) is<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><div id="Layer2"> <?include("nav.php");<br />?> </div><!--c2--></div><!--ec2--><br /><br />ive looked on php sites but "techno babble" just confused me<!--content-->
I can be wrong, but try:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><div id="Layer2"> <?php<br />include 'yourfile.php';<br />?> </div><!--c2--></div><!--ec2--><!--content-->
change<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><div id="Layer2"> <?include("nav.php");<br />?> </div><!--c2--></div><!--ec2--><br />to <br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><div id="Layer2"><br /><?php include ("nav.php"); ?> <br /></div><!--c2--></div><!--ec2--><br />you have no space after the <?<!--content-->
thanks Thomas and Don, Legends <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /><br />it looks to be working, i shall be going to London tomorrow with my head clear of all deadline worries <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /><br /><br />i was going in circles looking at the tech help on the net, it was "too deep" so as usual TCH family can help in <i>plain english</i> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
hmm.. just test <a href="http://testing.goldielookin.co.uk/hmm/" target="_blank">uploaded </a>it and it's killed all the images <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue_ss.gif" style="vertical-align:middle" emoid=":tongue_ss:" border="0" alt="tongue_ss.gif" /><!--content-->
Most likely a path issue with your images. You have them "images/....gif"<br /><br />Put the full path in there and I bet it works.<!--content-->
so id have to assign them all to my exact web address i.e <!-- w --><a class="postlink" href="http://www.mysite.com/image/header.gif">www.mysite.com/image/header.gif</a><!-- w --><br /><img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> seems annoying since i have to put them in the test area then also put the main folder!<br /><br />tried <a href="http://testing.goldielookin.co.uk/images/title.gif" target="_blank">http://testing.goldielookin.co.uk/images/title.gif</a> (i.e full path) and still no joy!<!--content-->
See if any of the answers in <a href="http://www.totalchoicehosting.com/forums/index.php?showtopic=13127" target="_blank">this thread</a> helps.<!--content-->
looks to be what i could be looking for, i'll have a hard read and play round with the code, if not im just going to have to go to back to SSI and log the fact PHP made me almost throw any PC devices through the window<!--content-->
Let us know how it goes. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
If your images directory is in your public_html directory then make your image links "/images/....gif". Note the leading "/" before images.<!--content-->
You are in a sub folder in a sub domain<br />that makes referencing images in the domain root/image folder tricky.<br />Why not copy the image folder to the sub domain/ sub folder for testing<br />so you can continue using the path you have now.<br /><!--coloro:#000000--><span style="color:#000000"><!--/coloro-->http://testing.goldielookin.co.uk/hmm/images/title.gif<!--colorc--></span><!--/colorc--><!--content-->
aha don! <br />cracked it!!<br />thanks ever so much! it was the domain thing!<br /><br />goldielookin.co.uk/phpphp works. (bits of it at <b>current</b> dont work as i need to change the code)<br /><br />php is still a pain, but at least it works <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /><br /><br />and after slashing the slashes... <i>it works </i> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /><!--content-->
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->php is still a pain<!--QuoteEnd--></div><!--QuoteEEnd--><br />Not really, just different.<!--content-->
it's a pain when you dont really "get it"<br />but i learn from my mistakes!<!--content-->
The title image shows fine.<br /><td colspan="3"><br /><br /> <img src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"images/title.gif" width="800" height="48" border="0" alt="Tourist Information"></td><br /></tr><br /><tr><br /><td rowspan="2"><br /><img src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"<b>/</b>images/left.gif" width="48" height="552" alt=""></td><br /><td><br /><img src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"<b>/</b>images/body.gif" width="586" height="522" alt=""></td><br /><td rowspan="2"><br /><img src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"<b>/</b>images/right.gif" width="166" height="552" alt=""></td><br /><br /></tr><br /><tr><br /><td><br /><img src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"<b>/</b>images/bottom.gif" width="586" height="30" alt=""></td><br /></tr><br /><br />the other images (left,body,right,bottom) have a forward slash that the title image doesn't . The slash in bold.<br />I think removing that slash will correct your problem.<!--content-->
yep i was doing that as you had typed that message <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
asides a few images i need to put in take (need some in the train station, and its hard to get them without getting told off!)<br />(it's a travel site for a project)<br /><br />it's all done..<br /><br />thanks ever so much to everyone that has helped in any way, shape or form!<br /> have some e-gold <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/potofgold.gif" style="vertical-align:middle" emoid=":potofgold:" border="0" alt="potofgold.gif" /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /><!--content-->
Once you get used to PHP<br />you will depend on it.<br />It can reduce the amunt of code you need by including common parts.<br />And its easier to make global changes.<!--content-->
Just remember to use single quotes around strings as this is faster. If you use double quotes PHP will scan the string looking for any variables in it. <br /><br />As Don says using PHP can make maintaining your site a lot easier. Every page on my site consists of three parts. The header, the content and the footer. The content only contains the include for the header, the actual HTML for that pages content and then the include for the footer. Using this method along with a CSS controlled layout means it's a lot easier to change your sites look.<br /><br />If you want I have some ebooks at home on PHP that I will happily send to you.<!--content-->
 
Top