Aureole Posted October 11, 2007 Share Posted October 11, 2007 Right now I have my Forum set up like... (don't worry it might look like a lot of code I'm posting but I don't have any errors or problems I'm just looking for feedback on something... just look through the code real quick at the comments mainly.) <?php session_start(); // Include and require. require('functions.swr3'); require('config.swr3'); // Check for stuff. if(SYSTEM_SHOW_PHP_ERRORS == 1) { error_reporting(6143); } if (userLogged()) { updateLastAction($_SESSION['mem_id']); updateWhere($_SESSION['mem_id'], 'viewing the Homepage'); } // Define variables... $pagetitle = 'Home'; $navcurrent = 'Home'; // Include header file... include('inc/header.swr3'); ?> Some HTML here perhaps... <?php // Let's query for something here just 'cause we can... while that's fetching results we'll have some more HTML... ?> And some more HTML... <?php include('inc/footer.swr3'); ?> Now I'm debating whether to make some kind of renderer instead so that instead of my jumping in and out of PHP all the time... I could do something like this... <?php session_start(); // Include and require. require('functions.swr3'); require('config.swr3'); require('renderer.swr3'); // Etc. etc. etc. // Rendering stuff here... like I don't know I was thinking having functions then doing something like...: renderHeader(); $title = 'Welcome'; $html = 'Hello and welcome to the site...'; renderContentBox($title, $html); renderFooter(); ?> What say you? Like is this more efficient/better coding practise/whatever... EDIT: Fixed loads of typos... Say renderContentBox() you give it $title and $html and it will construct a content box and return you a string of html... for example. Quote Link to comment https://forums.phpfreaks.com/topic/72711-rendering-now-with-added-typo-fixes/ Share on other sites More sharing options...
d22552000 Posted October 11, 2007 Share Posted October 11, 2007 My ENTIRE site is simply a 600kb "html/html.php" and functions, then when I change one thing in the style of the site, the ENTIRe site changes at once. <?PHP //EXCERPTS FROM HTML.PHP //... function index($before,$after,$level,$err) { echo $DOCTYPE.$HEADER.'Home'.$STYLE.$HEAD2.$STUFF.' //index content is here // '.$END; } //... ?> I even have it where the ENTIRE document has two version of the site where one version is xhtml (/>) and one is html (>) just incase I ever need both. It is much faster. I suggest you render everything at once... THEN echo it to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/72711-rendering-now-with-added-typo-fixes/#findComment-366697 Share on other sites More sharing options...
Aureole Posted October 11, 2007 Author Share Posted October 11, 2007 Render everything first then output it? Is that what I'm doing or not if I did it like how I said... I don't think I follow. ??? Quote Link to comment https://forums.phpfreaks.com/topic/72711-rendering-now-with-added-typo-fixes/#findComment-366698 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.