What is the best way to setup a php layout? Is it to use a class? Use functions and call on them when necessary, such as includeHeader(); includeMenu(); Or what?
Yeap! That in fact is my chosen option. Best to place all your functions in one page(x.php), include the page in every other page using the include(); function. And when you need to use the function, you can simply call it. If you ever need to edit your sites theme, all you have to do is simply edit one file(x.php) and your site/linked pages will be transformed according to your settings.
Put the function that you will always needed by your script in 1 files. That make you have less line code.
Include all functions in one page? Are you kidding? Imagine including a 1,000+ line file on every page just to call a couple of helper functions. If you want to learn how to properly structure projects and design PHP-based solutions, take a look at the PHP 5.x frameworks for reference.
there is no single right way for PHP code .. it depends on what youre doing, and like mentioned above, you dont want a giant overhead in file size , if you only need a few functions. part of PHP programming skill is learning how to make better , faster working scripts, etc. So asking how to do PHP in a single 'right way' .. is like asking how do you build a bridge in the single right way. It all depends where its at.
The way I have it is it includes a class on each page. Then when the page requires say the navigation menu, it calls for the function inside the class that contains the navigation. And I don't want to use a framework because its like learning another language...
If you are not familiar with php but know something abt coding in html/php than you can use wordpress cms to design.