Jump to content

Recommended Posts

The most aesthetically pleasing thing is to keep all your scripting out of your html.

 

You could do something like this:

 

<script language="php">include('my_fantastic_script.php');</script>
<html>
<head>
<title><?=$title?></title>
<link rel="stylesheet" href="<?=$stylesheet?>" type="text/css" />
<script type="text/javascript" src="<?=$javascript?>"></script>
</head>
<body>
<div id="wrapper">
	<div id="left_col">
		<h1><?=$h1_title?></h1>
		<?=$content?>
	</div>
	<div id="right_col">
		<?=col_content?>
	</div>
</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/264141-organize-your-code/#findComment-1353657
Share on other sites

Even when you do a plain <style> section rather than a separate file, doesn't it have to go within the HTML, not before your opening html tag?

 

nothing should be before your html tag, except your doctype

 

doctage
<html>
<head>
...
</head>
<body>
...
</body>
</html>

 

& some reading material: http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#adef-scope

Link to comment
https://forums.phpfreaks.com/topic/264141-organize-your-code/#findComment-1353957
Share on other sites

nothing should be before your html tag, except your doctype

 

That should really be phrased as no style sheets, javascript or HTML should be before your HTML tag. PHP is frequently, and most usually SHOULD be before any HTML.

 

 

CSS, and Javascript (unless its absolutely necessary to place it somewhere else), should be inside the head tag.

 

And it is of course better to get all CSS, and as much Javascript and PHP as possible out of the actual documents that contain HTML.

 

Where PHP is necessary in HTML is to format the display with conditionals.

Link to comment
https://forums.phpfreaks.com/topic/264141-organize-your-code/#findComment-1354045
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.