Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

PHP Template Design Pattern Help

Status
Not open for further replies.
Joined
Apr 26, 2005
Posts
7,414
Reaction score
151
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.

Rule #1: Be Respectful

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

Members online

No members online now.

Premium Members

New Threads

Domain Forum Friends

Lastest Listings

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom