Quote:
Originally Posted by Passionless
Hi,
Well you can embed HTML code into the script but a more flexible way is to include HTML templates passing to them some variables like error messages and such.
So you can add... include_once 'template.tpl.php'; ...instead of... die('Seems ok'); Then you 'template.tpl.php' file can contain, among all commom HTML elements (it's essentially a HTML page) some PHP blocks for dynamic contents:
<div class="box message">
<?php
echo 'You file: ', $_FILES['file']['name'], ' was succesfully uploaded!';
?>
</div>
That's extremely minimalist but point is the included template/script can access any variable you pass to it. So you can build a common template for the whole site and depending on context show different contents, like the upload form or a message page.
Good luck.
|
I guess thats pretty much how I do it, but correct me if Im wrong.
my index.php pretty much includes everything including a general div box.
I (re)direct everything in this way-> <a href=index.php?p=variable
as example variable might be login.php, so would be: index.php?p=login.php
<div class=blaat>
//in this case $page will be login.php, which will be included into your div class
$page = $_Get["p"];
if($page != "")
include_once($page);
else
// do nothing or show random page, w/e.
</div>
if thats what you meant simson, might be an ok sample for you?