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.

Discussion: building a strong code base for your site

Status
Not open for further replies.

Ciqala

Level 7
Legacy Platinum Member
Joined
Jul 22, 2002
Messages
872
Reaction score
0
I'm presently undertaking a rather large project of a modular site-builder in php/mysql that will allow me to dynamically create each page based upon the content i wish to display. i.e. news, reviews, articles.

i've been looking at the various ways of doing this and i'm curious which is the way others have gone about doing something similiar.

i'm presently leaning towards a class based system that generates all html output on the the fly in the php code itself but i know you can also try and separate the layout from the business logic by ways of html templates with {title} style variables which you then parse using php.

I know we have some talented coders here so this will hopefully make for interesting conversation.

Ciq
 

MarkyMark

Level 4
Legacy Gold Member
Joined
Aug 4, 2002
Messages
108
Reaction score
0
Im running a php/mysql site, check out my signature. Id be happy to give you some info of the programming of it and the benefits of PHP/mysql.
 

NameCaster

Level 8
Legacy Gold Member
Joined
Jan 2, 2003
Messages
1,984
Reaction score
0
Class based code is better in most cases.
But even classes use templates.

The answer to your question should be based on a few factors.
For an SMB you'd be better off using traditional template based code and MySQL, etc.
For a larger high traffic site you may want to consider class objects. There is a price to pay though. Objects tend to be a bit more CPU intensive.

Good Luck!
 

Ciqala

Level 7
Legacy Platinum Member
Joined
Jul 22, 2002
Messages
872
Reaction score
0
currently my site design is following this path...
(pseudo-code)
index.php?page=xxxx?id=xxxx
|
include(class.php);
$homepage = new $page
$homepage -> build_page()

class.php
|
class page
{
huge list of functions that perform any action i will need to make a page i.e. show_news($id), show_interviews($id), show_trailers($id)
}
class xxxx extends page
{
function build_page()
{
$this-> add_header();
$this-> show_xxxx();
$this-> show_footer();
}

this isnt exact syntax just an idea of what i'm doing

my problem is that the class.php is getting big (500 lines) and i am only about 1/3rd completed. is this a wise way of doing things?
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

Who has watched this thread (Total: 1) View details

The Rule #1

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

Members Online

Premium Members

Upcoming events

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators

Top Bottom