Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

PHP Template Design Pattern Help

Status
Not open for further replies.
Joined
Apr 26, 2005
Posts
7,435
Reaction score
148
Hi Guys

If I want to create easily reusable PHP template components, is it best to use a PHP object for each component? Can anyone link to a good tutorial on this?

Also, if I want to have a single PHP component that I can easily use across multiple sites, how can this be done?

Thanks :cool:
 
If your a complete beginner maybe start with something like

http://www.w3schools.com/php/

Tuts plus has some decent tutorials on php but you have to pay

A lot of great stuff is on YouTube as well

Are you just looking to include page elements like menus, sidebars footers etc

http://www.w3schools.com/php/php_includes.asp in a cpanel environment you can include files in multiple addon sites with the correct file path.

If your looking to build something serious in php, sites with user login database driven content follow a decent primer tutorial on php then jump in with a framework.
I highly recommend Laravel and this site has some amazing guides it looks complex at first but will save tons of time in the long run.
https://laracasts.com/series/laravel-5-fundamentals
 
Thanks. I'm not a complete beginner, I know how to do the standard PHP include. However, at the moment, I only know how to do this on a single site.

What I'm specifically looking at is ways to create a component based system that can easily be updated over multiple sites, e.g. all sites have a shared footer, and you only have to amend it once then all sites use the update.

Thanks
 
What I'm specifically looking at is ways to create a component based system that can easily be updated over multiple sites, e.g. all sites have a shared footer, and you only have to amend it once then all sites use the update.
Thanks

If the sites are going to be on the same cpanel then your standard include will work just enter the full path to the file

Code:
[COLOR=#007700][COLOR=#007700][COLOR=#007700]include [/COLOR][COLOR=#dd0000]'/home/somefolder/someotherfolder/footer.php'[/COLOR][COLOR=#007700];[/COLOR]
[/COLOR][/COLOR]


Alternatives would be to store you code in a database accessable by all the sites
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel
Acorn Domains Merch
MariaBuy Marketplace

New Threads

Domain Forum Friends

Other domain-related communities we can recommend.

Our Mods' Businesses

Perfect
Service
Laskos
*the exceptional businesses of our esteemed moderators
Top Bottom