ignace, I should have been more specific. The bits of code that you quotes (a function call or variable echo) are actually classes. So the nature of the website is very much like a forum, and you can make a post of sorts. So right now, the tables are set up to hold the data and that variables are actually class functions that echo data already pulled from the SQL database (very very close to the examples you sited). This is true for both classes. So the page class has functions to output various parts of the page, read the page and set all the data when teh page is loaded, go to the next page, etc etc. The user class can do things like signup, post, change profile info, everything you do here. Eventually I'll add an admin subclass to that very much like what you have, but i'm a ways from that right now
That being said, that answered my question perfectly. oni-kun mentioned it's not bad practice, and you got even more specific and suggested WHAT should be in those outputs and functions (which happened to be what I was doing). As I was not looking forward to redoing everything, I am very happy to hear that haha. The implements Iterator was something I hadn't thought of either and will need to put in.
Indecently, the only time we'd use innerHTML (could be document.write, really any output depending) is if it's a dynamic part of the page that won't be seen unless a javaScript even is triggered (say a box that pops up to log in or something). all the rest are statically written into the page.
So that I'm sure I understand you correctly ignace, if I already have the classes like that, then it would therefore be OK to output (using more accurate versions of my previous examples):
document.whatever.innerHTML = "<?php $page->DisplayPostTitle($row); ?>"; //(actually would be three parts i guess, since JavaScript as to put in the row, close enough)
<?php $user->displayUsername(); ?> //ok, these examples arn't much better, most of the functions do more than just write a variable
Finally, most of these I wrote functions to output the variable in the class ($row for instance is the position in an array that was pulled from mySQL). Siting your examples, this is a better way of doing it than actually echoing a public variable? Most of what's being called has other things it needs to do as well (a meaningful function unlike my examples) like logging in , moving to the next page, editing a post possibly...etc.
Sorry for the confusion. Your examples are great though, this isn't a forum but its user generated content very much like a forum.