Basic PHP Question

  • The Apostle of God
  • Beginner
  • Beginner
  • User avatar
  • Posts: 54
  • Loc: SDSU, SD, USA

Post 3+ Months Ago

I'm getting an error on some very simple php code. I'm new to php, and would really appreciate help with this. Also, if what I'm doing is a common mistake or you see any, please, let me know!
Code: [ Select ]
<?PHP
{  
echo("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"); 
echo("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n");  
echo("\n<head>\n");  
echo("        <title>");  
}
PHP?>
This is only a test
<?PHP
{
echo("        </title>\n");
echo("<link href="/styles/main.css" rel="stylesheet">\n");
echo("</head>\n");
echo("<--test-->");
}
PHP?>
  1. <?PHP
  2. {  
  3. echo("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"); 
  4. echo("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n");  
  5. echo("\n<head>\n");  
  6. echo("        <title>");  
  7. }
  8. PHP?>
  9. This is only a test
  10. <?PHP
  11. {
  12. echo("        </title>\n");
  13. echo("<link href="/styles/main.css" rel="stylesheet">\n");
  14. echo("</head>\n");
  15. echo("<--test-->");
  16. }
  17. PHP?>

I'm getting a parse error on line 13, which is where I reference my style sheet.

If someone could point out my mistake, I would be indebted.

Also, could I get some feedback on the following?
What I want to do is set up my pages on my site where they all reference a core set of php files. The above two files will eventually be a part of this, goal being I can declare variables on the page and set them to titles, metas, etc on the main php page, and then call the sites standard navigation menus. Then have the page just use standard html for the main content area, goal being the ability to have compliant html generated by the php, but be able to alter the central files and see it take effect sitewide.

But obviously, I have to fix the stupid parse error first :p
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

You're getting a parse error because you didn't escape the quotes in rel="stylesheet" with backslashes. Also I don't think you need to have the curly brackets {} before and after the echo, although I don't think that will generate an error.
  • The Apostle of God
  • Beginner
  • Beginner
  • User avatar
  • Posts: 54
  • Loc: SDSU, SD, USA

Post 3+ Months Ago

Thanks! That works great!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: demonmaestro and 171 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.