OOP Vs Procedural style
Posted: Tue Mar 09, 2010 3:10 am
Hi all,
i'm developing some kind of profile system for an organization that will have pages like index, login, profile, inbox and so on. i want to combine a mixture of oop and procedural style programming in php. i have decided to use oop in creating objects for example users, and database connection.
i dont know whether i should also make a page object or just hardcode header and footer files into the different pages. for example if i hardcode this is how my files will appear:
however if i use oop in my templating it will appear:
what do u suggest would be the best practice or what would you recommend? Thanks!
i'm developing some kind of profile system for an organization that will have pages like index, login, profile, inbox and so on. i want to combine a mixture of oop and procedural style programming in php. i have decided to use oop in creating objects for example users, and database connection.
i dont know whether i should also make a page object or just hardcode header and footer files into the different pages. for example if i hardcode this is how my files will appear:
Code: Select all
<?php include("header.php") ?>
<div class='container'>
// Content goes here
</div>
<?php include("footer.php") ?>Code: Select all
<?php
$page = new page($page_variables);
$page->displayHeader($header_variables);
$page->displayBody('<div class="container"></div>');
$page->displayFooter($footer_variables);
?>