Jump to content

Archived

This topic is now archived and is closed to further replies.

pedro84

New site/ some questions

Recommended Posts

WElcome Everyone!

I wanna to ask You some questions:

index.php
[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Michael-Schenker.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>


<?php
include('includes/header.php');
?>

<?php
include('includes/menu.php');
?>

<?php
include('includes/content.php');
?>

<?php
include('includes/footer.php');
?>


[/code]
ew. included file

[code]<?php

echo "<div id=\"footer\"><p id=\"copy\">Copyright 2006 Michael-Schenker.com</p></div>\n";
echo "</div>\n";
echo "</div>\n";

echo "</body>\n";
echo "</html>\n";

?>[/code]

Am I doing it right? Is it good way to make my site validating?

Share this post


Link to post
Share on other sites
You don't have to go in and out of PHP for the includes.
[code]<?php
include('includes/header.php');
include('includes/menu.php');
include('includes/content.php');
include('includes/footer.php');
?>[/code]

Everyone has his or her preference when writing HTML code from php. Some people prefer the HEREDOC method:
[code]<?php
echo <<<EOF
<div id="footer"><p id="copy">Copyright 2006 Michael-Schenker.com</p></div>
</div>
</div>
</body>
</html>
EOF;?>[/code]

Some people prefer to use one long string:
[code]<?php
echo "<div id='footer'><p id='copy'>Copyright 2006 Michael-Schenker.com</p></div>
</div>
</div>
</body>
</html>\n";?>[/code]

You can write code that won't validate no matter you chose to write it.

Ken

Share this post


Link to post
Share on other sites
You do not validate the PHP, you validate the HTML that the PHP produces. So, this really isn't a PHP question. But, I don't see anything glaringly wrong with your code, but you can always submit it for validation. (search on google)

Share this post


Link to post
Share on other sites
just link the css on your index.php page like you already have. but instead of doing your html like you have done above in one of your included files, do what ken said. it is a lot more error free.

Share this post


Link to post
Share on other sites
I fixed them. I have next question:

How to make structure as follow:
_root =>index.php
data => files ex. discography

How to make them? I tried but I got errors that cannot find path:|

Sorry for my  maybe stupid questions but I want to make it good.

Thank You once again.

Share this post


Link to post
Share on other sites
not sure what you mean... if you want to link to your index file and it is in the same as the file your linking from just do:
[code=php:0]include './index.php';[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.