I'm guessing that phpBB is doing things the "right way".. that is, separating 
presentation and logic.  In cases like that, you have your PHP code and your 
HTML in separate files with as little 'logic' in the HTML as possible.

I'm kind of oversimplifying the explaination and I'm sure there are "more 
profressional" php developers that can describe it more precisely, but the 
general theory is to let your programmers program and let your designers design 
and this is a way to keep them out of each other's hair and make the code and 
layout easier to maintain.

Just because you change the graphics or layout of a page, doesn't mean you need 
a PHP developer to go in there and wade through the tangles of PHP code to do 
so.  Most web design people are smart enough to understand things like "make 
sure this input box is of this type and has this name and/or id and/or other 
kind of label".  Even to keep basic PHP stuff like foreach loops intact when 
redesigning.  They don't wanve to have to see all the database calls and array 
processing that we end up dealing with.


Over simplfied example:

<?php

########################
# editform.php - this form allows editing of a single record
########################

// connect to db

// perform queries

// process data

// set some conditions

include("editform.tpl");  // include the template file with all the HTML
?>

<head>
  <title>Edit Form</title>
</head>
<body>
<form action="someprocessor.php" method="POST">
Username: <input type=text name="username" value="<?php echo $username; ?>"><br>
Is Active?: <input type=checkbox name="isactive"<?php echo $isactivechecked; ?>>
<br>
</form>
</body>

This keeps minimal PHP code in the tpl (template) file and keeps it mostly HTML 
for easy editing without confusing a non-PHP oriented web developer.

That's a really really basic example, but that's one general coding standard.

One of these days I hope to actually get to work like that.  I keep inheriting 
big projects that are too much of a mess already that they'd have to be 
re-written to work like that.. hah

Good luck Alex!

-TG

= = = Original message = = =

Hi List,
    I've been (very slowly) working my way through some basic php, and
putting it into my html site. However recently (after trying things out such
as cookies or redirects where they have to be set before any page output)
I've found that the combination or certainly the way that I'm using php and
html together dosn't seem to go too well.

I have a question to you experienced PHP developers, how do you mix the
html/php together. When I've looked at things like the PHPBB forums, and
gone through files they will have absolutly no HTML, just php code. I'm not
sure how they manage their page styling, if anyone could explain this too
me. 

At the moment I have things such as
<table ...>
<?php
Some php code making a page header
?>
</table>
<table ...>
<?php
Content...
?>
</table>

I'm sure that I'm not doing it the best possible way, so if anyone has any
tips for me.


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to