Re: how include works?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arno Kuhl wrote:

Well I certainly don't come close to knowing all there is to know about PHP
and I'm always keen to learn something new - can you show me an example of a
file being included more than once, and why it's required more than once
during the same request? I can obviously include straight html code multiple
times but that doesn't really count.


Why does that not count? That's exactly what I'm doing. For example, on one of my sites I have a toolbar. Each button on that toolbar is created from the same template file. So, that file gets included on each page more than once. On some pages it's a lot more than once. Why doesn't that count?

Or chunks of php code where a function
would do the same job, but that's the unrealistic situation Peter was
talking about.I can probably even concoct an artificial and contorted
scoping scenario that would demonstrate it (though thinking about it, PHP
would know the included file/functions/variables had fallen out of scope, so
even a include_once would include the file again at that point, so it
wouldn't really demonstrate anything). I'd be very interested in seeing
multiple includes of the same file actually applied in a real-world
situation - filling a bleeding obvious knowledge gap and seeing how other
people approach problem solving is always interesting and useful.

Templates. Templates. Templates. That's it. Nothing more complicated than that. I've not come across any other reason to include a file more than once - anything that someone thinks should result in that is almost certainly in need of some functions. Hope that answers your question.

-Stut

PS. Please stop replying directly to me. Always include the list.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux