Jump to content

Html code in php


MRWEARDO

Recommended Posts

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

 

/* 
------------------
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'];?>
------------------
*/

 

 

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
/* 
------------------
HTML VARS : atributes and elements
Created By Olivier De Cock
MrWeardo@hotmail.com
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'] = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">';
//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'] = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
//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'] = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
//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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Page title</title>
</head>
<body>



</body>
</html>
------------------
*/


/* 
------------------
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'] = '<title>Page title</title>';  // i have placed this in 1 line sind u never split them 


$html['html-s'] = '<html>';
$html['html-e'] = '</html>';

$html['head-s'] = '<head>';
$html['head-e'] = '</head>';

$html['body-s'] = '<body>';
$html['body-e'] = '</body>';


//Place ur Atributes here 
$html['body-bg1'] = '<BODY BGCOLOR="gray" TEXT="red" >';
$html['body-bg2'] = '<BODY BGCOLOR="black" TEXT="silver" >';

//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'] = '<a href="http://www.example.com/" target="_blank">externallink</a><br />';
$html['link-2'] = '<a href="index.php" target="index.php">internallink</a><br />';


//Place ur html-comments here
$html['htmlcomment-1'] = '<!-- the page is ending --><h4>here we commented that the page is ending</h4><!-- ending of the page --><p>This article demonstrates the HTML code to hide your comments.</p>';





?>

 

 

so help is appreciated in expanding the file and examples

 

Link to comment
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.