imajin8shun 0 Report post Posted July 6, 2005 Okay now... I'm pretty sure I have php and all that working but I preview it and it shows NOTHING! Zippo Nadda Zlich! Now I'm going to paste the code so forgive me if I use the wrong box thingy. <?phpecho <<<END<head><TITLE>FEAR AND LOATHING | did I say that out loud? can they hear me?</TITLE><LINK media=screen href="index.css" type=text/css rel=stylesheet><META content="Microsoft FrontPage 4.0" name=GENERATOR><body bgColor=#C7B299 leftMargin=0 topMargin=0 onload="window.defaultStatus='FEAR AND LOATHING IN LAS VEGAS';" marginheight="0" marginwidth="0"><center><table cellSpacing=0 cellPadding=0 style="border: 0pt;"><tr vAlign=top><td><img src="new.jpg" border=0></td></tr></table><table cellSpacing=0 cellPadding=2 width=529 style="border: 0pt;"><tr vAlign=top><td width=150 bgColor=C69C6D><?php include("menu.php"); ?></td><td cellpadding="0" width=371 bgColor=#C69C6D style="border: 0pt;"><?php include("blog.php"); ?></td></tr></table> </td></tr></table></table></body><END ?phpecho> Can someone please hcek this to see if its right, and if not can you please correct it for me? Thanks in advanced. Share this post Link to post Share on other sites
SunBlind 0 Report post Posted July 6, 2005 Oh, sweetheart, we need to talk...First of all, your page starts off with an echo (which is supposed to look like this:) <?php echo(); ?> I admit that I'm not the brightest crayon in the box, and I've never seen a page begin this way, so I'll automatically assume that it's a mistake... What are you echoing? Second of all, if you're going to code your entire page in PHP, you just can't open with a PHP tag and then start HTML'ing... It's going to cause parse errors. Your page doesn't have to begin with PHP to become a .php page. From what I can see, the whole point of making this a PHP file is to include your blog and menu, right? All you have to do is take out the deformed echo tags at the beginning and end of the codes, keep your include code, and save the page as a PHP file. Here, I'll do the work for you:<html><head><TITLE>FEAR AND LOATHING | did I say that out loud? can they hear me?</TITLE><LINK media=screen href="index.css" type=text/css rel=stylesheet><META content="Microsoft FrontPage 4.0" name=GENERATOR><body bgColor=#C7B299 leftMargin=0 topMargin=0 onload="window.defaultStatus='FEAR AND LOATHING IN LAS VEGAS';" marginheight="0" marginwidth="0"><center><table cellSpacing=0 cellPadding=0 style="border: 0pt;"><tr vAlign=top><td><img src="new.jpg" border=0></td></tr></table><table cellSpacing=0 cellPadding=2 width=529 style="border: 0pt;"><tr vAlign=top><td width=150 bgColor=C69C6D><?php include("menu.php"); ?></td><td cellpadding="0" width=371 bgColor=#C69C6D style="border: 0pt;"><?php include("blog.php"); ?></td></tr></table> </td></tr></table></table></body></html> And one more thing: If your page is coded in PHP, unless you have PHP installed on your computer and your file is saved in the directory that the installation reads (usually htdocs) when you preview it you'll just see code. If you program the page with an HTML/PHP mix, you'll only be able to see the HTML, but at least it's a lot prettier than brackets and question marks :/ Good luck! Hope this helped a little. Share this post Link to post Share on other sites
imajin8shun 0 Report post Posted July 6, 2005 I changed it, uploaded to my public_html folder in Xisto... comes up saying theres an error in line 1... the first line is "<html><head>" just like you said sunblind. I'm not saying its your fault or anything... I'm just saying it didnt work, any ideas why? Share this post Link to post Share on other sites
vizskywalker 0 Report post Posted July 6, 2005 Okay, first of all, Sunblind is only half right. Echo is a very special command in php and has three main forms:1) echo();2) echo"";3) echo <<<ENDEND;The third is for large blocks of html code so except for needing a space between <?php and echo and between <<<END and <html> nothing is wrong with the first line.However, you do need an <html> tag before your <head> tag as well as after the last html statement.Second major issue, once you invoke the php compiler with the <?php tag, you cannot reopen it. The way to add your php statements is not by adding (for example) <?php include("menu.php"); ?> but by closing the echo and simply adding the php code like so: END;include("menu.php"); Then to reopen a large echo, create a large echo block the same way you did the first time but instead of making the ending word END make it something else, like ENDHTML.Then, after your </body> tag place an </html> tag and on the next line write ENDHTML; and on the last line use the tag to close the php compiler: ?>Because most of your code is html, you could do what Sunblind said, and instead of echoing the html, simply write the html and where you want the php code, invoke the compiler the same way you tried to do in your code.Also, be sure you save the page with a .php extension or everything will be treated as html code, not php code.If any of this confuses you, be sure to ask more questions. ~Viz Share this post Link to post Share on other sites
overture 0 Report post Posted July 6, 2005 The code works fine for me. It may be the including files which may be the issue, there maybe something wrong with them. Try making a blank html page and type something in it and save it as test.html. Then include that and nothing else: <html><head><TITLE>FEAR AND LOATHING | did I say that out loud? can they hear me?</TITLE><LINK media=screen href="index.css" type=text/css rel=stylesheet><META content="Microsoft FrontPage 4.0" name=GENERATOR><body bgColor=#C7B299 leftMargin=0 topMargin=0 onload="window.defaultStatus='FEAR AND LOATHING IN LAS VEGAS';" marginheight="0" marginwidth="0"><center><table cellSpacing=0 cellPadding=0 style="border: 0pt;"><tr vAlign=top><td><img src="new.jpg" border=0></td></tr></table><table cellSpacing=0 cellPadding=2 width=529 style="border: 0pt;"><tr vAlign=top><td width=150 bgColor=C69C6D></td><td cellpadding="0" width=371 bgColor=#C69C6D style="border: 0pt;"><?php include("test.html"); ?></td></tr></table> </td></tr></table></table></body></html> If that works fine and it shows what you have written in the html file then it is most likely something wrong with your menu.php or blog.php. Share this post Link to post Share on other sites
SunBlind 0 Report post Posted July 6, 2005 Yeah I figured I'd screw that up somehow Lol Sorry, imajin8shun. I'll just go back to playing in the Photoshop forum where I belong...*slowly backs away* Share this post Link to post Share on other sites
imajin8shun 0 Report post Posted July 6, 2005 Okay thanks. Umm Well I figured out what was wrong, I had the code in their twice lol so I think that might of done something, lol. Anyways I fixed it, uploaded it then viewed it, and it all seemed to be working, except for when I view source and for some reason the php coding I used didn't showup, instead it came up with all the old html codes I used in the orginal layout before I created a php one. I find this to be very strange.http://forums.xisto.com/no_longer_exists/ https://p''>https://p'>http://forums.xisto.com/no_longer_exists/ https://pThats the link, if you go to it and view source you'll see what I mean. But I have got school to go to so I won't be able to try out the other options you guys have given me, but as soon as I get back I'll try them out and let you guys know if it worked. Cheers. Share this post Link to post Share on other sites
vujsa 0 Report post Posted July 6, 2005 OK, that was a good practice run imajin8shun. We gave you a sample to play with you tried it had a few problems and learned how to use a limited amount of php. Because php is a server sided script, the php will not show up in the view source. The server reads the php and returns the required HTML to produce the page you designed. The browser will never see the php, only the server. While javascript is a client side script, it will show up in the view source. The exaple shown here is an HTML document that utilizes PHP for semi-dynamic content. I suggest that your next practice script be an attempt to create another document that uses even more PHP. Perhapes a routine to insert the current date and time into the page. Try to put something like Today is July 6th, 2005 into your page. To do this first start at the top of the page with your PHP open tag. <?php Then we need to assign a variable to the date. $today = date("F jS,Y"); Then close our PHP. ?> Next in our page we call for the date. <b>Today is <?php echo $today; ?>.</b> Here it is all together: <?php$today = date("F jS,Y");?><html> <head> <title> HTML-PHP Current Date Test </title> </head> <body> <center> My Title! </center><br> <b>Today is <?php echo $today; ?>.</b><br> <br> Welcome to my test page! </body></html> Hopefully this will show you a few more ways to combine HTML and PHP. Happy Scripting. vujsa Share this post Link to post Share on other sites
imajin8shun 0 Report post Posted July 7, 2005 Thanks for all your help guys... I think I'm finally starting to understand php. Just a few more tests and I should have my website up and running using php within no time. Share this post Link to post Share on other sites
iGuest 3 Report post Posted July 7, 2005 PHP start tag = <?phpPHP end tag = ?>PHP short start tag = <?PHP short echo tag = <?=There's no <?phpecho or ?phpecho>You must have white space between <?php e.g. <?php echo 'some text'; ?>Examples:<?php echo 'this is simple php'; ?><? echo 'this may or may not work, dependant if short_tags = on in php.ini'; ?><?= 'relies on short_tags being on'; ?>To be more cross supported, use full tags compared to short tags, in fact, don't ever use short tags.I've cleaned up your code, fixed a few noticable problems, so hopefully this is a starting point for you to write better well-formed web pages, and better PHP programming guides, just look at the difference of your above code to my below code. <?php$menu_php = 'menu.php';if(file_exists($menu_php)) $menu = file($menu_php);else $menu = 'Error: menu does not exist';$blog_php = 'blog.php';if(file_exists($blog_php)) $blog = file($blog_php);else $blog = 'Error: blog does not exist';echo <<<END<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ https://d xmlns="http://forums.xisto.com/no_longer_exists/ https://4; xml:lang="en"><head> <title>FEAR AND LOATHING | did I say that out loud? can they hear me?</title> <link media="screen" href="index.css" type="text/css" rel="stylesheet" /></head><body style="background-color: #C7B299; margin: 0px;" onload="window.defaultStatus='FEAR AND LOATHING IN LAS VEGAS';"> <div align="center"> <table cellspacing="0" cellpadding="0" style="border: 0pt;"> <tr> <td> <img src="new.jpg" style="border: 0pt;" alt="new" /> </td> </tr> </table> <table cellspacing="0" cellpadding="2" width="529" style="border: 0pt;"> <tr> <td width="150" style="background-color: #C69C6D;"> $menu </td> <td width="371" style="background-color: #C69C6D; border: 0pt;"> $blog </td> </tr> </table> </div></body></html>END;?> Cheers,MC Share this post Link to post Share on other sites
imajin8shun 0 Report post Posted July 7, 2005 Wow that looks excellent, thanks alot for doing that master computers! I really appreciate the help and support, from all of you. Share this post Link to post Share on other sites