Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Code practise: require_once

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Tue Oct 14, 2003 11:00 am    Post subject: Code practise: require_once Reply with quote

As I'm always learning I was wondering about the following code practise.

When I make a site with smarty I have a central setup.php file. Each page I make is refering to this page.
I also luve to use classes. As we al know you need to initiate a class.

My question is: is it wise to but this in al the classes via required_once('class1.php') in the setup.php. And $class = new class($db);... in the setup.php
Doesn't it make the site slower the more classes you have? For example 10, 20 classes...
Doesn't it make this smarty slower?

What would be the correct code practise for this.
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
inerte
Smarty Rookie


Joined: 24 Sep 2003
Posts: 9

PostPosted: Fri Oct 17, 2003 6:02 pm    Post subject: Reply with quote

Yes, it make PHP slower to require a lot of files.

Usually what I do is require only widely used classes on the central file, and smaller parts where they are needed.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP