Thanks, Bob. I'm surprised (and pleased!) to learn it works this way. Re: include_once() vs. include() - they truly serve two different purposes.
Use include() when you want to include the same file multiple times, at different parts of your page. Use include_once() when you need to prevent a file from inadvertantly being included multiple times. Mike On 8/9/2005, "Bob" <[EMAIL PROTECTED]> wrote: >Hi Mike, >Yep, you can include html, no probs without echoing it. ><html><head><title><?php echo $title; ?></title> etc. > >Every example I see lately seems to use "include_once" regardless of whether >it could be included twice or more. >I was beginning to think that "include" was redundant. >Must be belt and braces strategy? > > >----- Original Message ----- >From: "Mike Franks" <[EMAIL PROTECTED]> >To: <[email protected]> >Sent: Tuesday, August 09, 2005 1:31 PM >Subject: Re: [php-list] Include files > >> On 8/9/2005, "Bob" <[EMAIL PROTECTED]> wrote: >> >>>Is there anything wrong with using:- include_once "header.php"; >>> >>>where the header is just html, and include "header.php"; would have done? >>> > >> No... but I'm not sure what either one would accomplish. If header.php >> truly contains just html, you would end up with something like: >> >> <?php >> >> // begin included file >> <html><head><title>My Header.PHP</title></head> >> // end included file >> >> ?> >> >> This would not work - PHP wouldn't know what to do with "just" html. >> >> I do something similar, except header.php would contain: >> >> echo '<html><head><title>My Header.PHP</title></head>'; >> >> Mike > > > > >Community email addresses: > Post message: [email protected] > Subscribe: [EMAIL PROTECTED] > Unsubscribe: [EMAIL PROTECTED] > List owner: [EMAIL PROTECTED] > >Shortcut URL to this page: > http://groups.yahoo.com/group/php-list >Yahoo! Groups Links > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12ht2phbo/M=362335.6886445.7839731.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1123617696/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!</a>.</font> --------------------------------------------------------------------~-> Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
