Jump to content


Photo

New site/ some questions


  • Please log in to reply
7 replies to this topic

#1 pedro84

pedro84
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 21 October 2006 - 05:43 PM

WElcome Everyone!

I wanna to ask You some questions:

index.php
<!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');
?>


ew. included file

<?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";

?>

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


#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 21 October 2006 - 06:00 PM

You don't have to go in and out of PHP for the includes.
<?php
include('includes/header.php');
include('includes/menu.php');
include('includes/content.php');
include('includes/footer.php');
?>

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

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

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

Ken

#3 pedro84

pedro84
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 21 October 2006 - 06:02 PM

Don't understand at all:)

But when I'm validating my source is it good:)

#4 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,891 posts
  • LocationCanada

Posted 21 October 2006 - 07:47 PM

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)
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#5 pedro84

pedro84
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 22 October 2006 - 10:43 AM

Another question.
Do I have to have css link in all pages? How to include it?

#6 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 22 October 2006 - 11:45 AM

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.
Good luck with your coding.
Jason / ProjectFear / Jaysonic

#7 pedro84

pedro84
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 22 October 2006 - 12:08 PM

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.

#8 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 23 October 2006 - 09:18 AM

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:
include './index.php';

Good luck with your coding.
Jason / ProjectFear / Jaysonic




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users