Html code in php

for a while i have been thinking of making the programming easier in php
not sure if this wil be the same for other users here but i kinda find this much more fun to program
instead of writing all ur html code over and over again i use snippets for blank html files or tables or body backgrounds and atributes

now for extending my knowledge i would like other users to help me in my script design. also i want to make it so that a user has a choice in my html file i am useing the $html[‘body-bg1’] wich is a body backround as inline css

so those options would make inline css styles then i use a kinda language system wich i edited to change when a user wants to to external css with a different template and then as 3the option but different for every website

a logged in user can choose his own template by editing his profile wich wil then be choosen or extracted by the mysql

now i am just as far as putting some html codes in html.php

this is how my blanck html page looks like

[php]
/*

html index basic : our new html page looks like this

<?php include_once 'html.php'; ?> <?php echo $html['doctype-1']; ?> <?php echo $html['html-s'];?> <?php echo $html['head-s'];?> <?php echo $html['title']; ?> <?php echo $html['head-e'];?> <?php echo $html['body-s'];?> <?php echo $html['body-e']; ?>

<?php echo $html['html-e'];?>

*/[/php]

as u can see they have an s or an e assigned wich says start or end

as for the include file is here

[php]

<?php
/*

HTML VARS : atributes and elements
Created By Olivier De Cock
[email protected]
This is an example file
u can edit this in anyway add as much code as u like to help extend the
file.

i did not write the html code from my head and neither should u
all these examples can be found on the net i just used the code
to put them in varriables for php so websites can easy be edited
and provide a better script overvieuw when writing in php.


*/

$html = array();

// Basic doctypes
//The following DOCTYPEs are commonly used:
$html[‘doctype-1’] = ‘’;
//This declares the document to be HTML 4.01 Strict. HTML 4.01 Strict is a trimmed down version of HTML 4.01 that emphasizes structure over presentation. Deprecated elements and attributes (including most presentational attributes), frames, and link targets are not allowed in HTML 4 Strict. By writing to HTML 4 Strict, authors can achieve accessible, structurally rich documents that easily adapt to style sheets and different browsing situations. However, HTML 4 Strict documents may look bland on very old browsers that lack support for style sheets.
$html[‘doctype-2’] = ‘’;
//This declares the document to be HTML 4.01 Transitional. HTML 4 Transitional includes all elements and attributes of HTML 4 Strict but adds presentational attributes, deprecated elements, and link targets.
$html[‘doctype-3’] = ‘’;
//This declares the document to be HTML 4.01 Frameset. HTML 4 Frameset is a variant of HTML 4 Transitional for documents that use frames.
//Well u get the idea by now ofcourse u have many other doctypes older and newer etc …

/*

HTML VARS : starting tags and ending tags

*/

/*

html index basic : basic html page looks like this

Page title ------------------ */

/*

html index basic : our new html page looks like this

<?php include_once 'html.php'; ?> <?php echo $html['doctype-1']; ?> <?php echo $html['html-s'];?> <?php echo $html['head-s'];?> <?php echo $html['title']; ?> <?php echo $html['head-e'];?> <?php echo $html['body-s'];?> <?php echo $html['body-e']; ?>

<?php echo $html['html-e'];?>

*/

$html[‘title’] = ‘Page title’; // i have placed this in 1 line sind u never split them

$html[‘html-s’] = ‘’;
$html[‘html-e’] = ‘’;

$html[‘head-s’] = ‘’;
$html[‘head-e’] = ‘’;

$html[‘body-s’] = ‘’;
$html[‘body-e’] = ‘’;

//Place ur Atributes here
$html[‘body-bg1’] = ‘’;
$html[‘body-bg2’] = ‘’;

//ofcourse with some php skills u can assign logged in vallues or any other req to see different styles like lets say u want the file to check if user is online use the if else function and switch the case of bg styles or other atributes

//Place ur links here
$html[‘link-1’] = ‘externallink
’;
$html[‘link-2’] = ‘internallink
’;

//Place ur html-comments here
$html[‘htmlcomment-1’] = ‘

here we commented that the page is ending

This article demonstrates the HTML code to hide your comments.

’;

?>
[/php]
so help is appreciated in expanding the file and examples

Hi mrweardo,

Actually, a lot of people are already doing this. You are right, that is the right way to do it. You don’t have to go through all this trouble. If you want a set of templates, you can try CMS(Content Management Systems) eg:Joomla, Drupal facebook. They already have a set of snippets of html and php files that is ready to use.

Regards,
developer.dex2908

Sponsor our Newsletter | Privacy Policy | Terms of Service