Reply to Re: Functions v includes

Your name:

Reply:


Posted by Erwin Moller on 02/16/07 15:26

Richard wrote:

<snip>

>> Can the include path
>>> just be set once for a single session?
>>
>> Yes, if you want. Store the path in the $_SESSION.
>> I don't see the advantage, but I don't know your application of
>> course.
>
> to avoid the meed to call to set the include path in every file which
> needs to include files. Am I confusing myself? Must the include path be
> set in an ini file which is included in every page which makes use of
> such includes?

Well, you can set the includepath in php.ini, but that has the problem that
(on most hostingsenvironments) your php.ini settings are used in every site
that uses PHP. Not really neat.

That is why I set them explicitly for each project in a simple includefile.

And I expect (very personal opinion) that your ARE confusing yourself by
making the included scripts session dependent.
If you design carefully you can simply include the functions you need
everywhere, and just call them when needed.
How I see it: You are fixing a speedproblem that isn't even there, as far as
I can judge of course.

As I mentioned in my former posting: almost all speedproblems with PHP are
databaserelated, and that is not PHP's fault. :-)

But maybe I misjudge, and you have a a dozen of includefiles of 5 megabyte.
Then it makes sense to be more picky, but if they stay under 100K, I
wouldn't worry too much...

>
>>
>> or in every file which references
>>> includes?
>>
>> I do not understand that question. :-/
>
> Hopefully clearer above :/
>
>>
>> Can you recommend a web resource which covers this type of
>>> stuff?
>>
>> All the above, which was just published on this great resource:
>> comp.lang.php.
>> ;-)
>>
>> On a sidenote: If you feel comfortable with OO, you can also design your
>> application with objects. This leads to a very different kind of
>> programming, but also let you design in a neat way. It is a matter of
>> taste what you prefer. Personally I like both. :P
>
> I will move to objects but am just getting a feel for php first and its
> libraries etc.

Good. No need to dive into objects yet.
Anything an object can do, you can write in another way and approach it in
the good old procedural way: with functions and normal logic.
If you are comfortable with procedural PHP, maybe then switch.
You actually don't need Objects in PHP, they just make your life easier once
you know them. :-)


>
>>
>> Hope that helps.
>
> It has been a GREAT help, thanks.

Glad to hear that. :-)

Good luck.

Regards,
Erwin Moller

>
>>
>> Regards,
>> Erwin Moller
>>
>>
>
> --

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация