Reply
Server side includes inside of includes?
Old 10-22-2009, 12:26 AM Server side includes inside of includes?
Experienced Talker

Posts: 47
Name: Andrew
Trades: 0
I'm new to php. After some experimentation, I have found that I can have a php include file inside of another php include file, and it seems to work.

1st level: Page on site
2nd level: Include file
3rd level: Include file (shows up on Page on site)

This feature did not seem to work for me when using ss includes in web pages with .html extensions.

I was wondering if having includes inside of includes (in .php files) is an OK, are there any problems I might run into with this type of arrangement? It's helpful for me because I get to separate pieces of code which makes it easier to modify down the road. Thank you for any suggestions.
andrew99 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 10-22-2009, 01:17 AM Re: Server side includes inside of includes?
mtishetsky's Avatar
King Spam Talker

Posts: 1,166
Name: Mike
Location: Mataro, Spain
Trades: 0
In php it is quite normal to include files with includes.
__________________
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 10-22-2009, 01:41 AM Re: Server side includes inside of includes?
Experienced Talker

Posts: 47
Name: Andrew
Trades: 0
Thanks for the heads up. Php seems so much more powerful than standard html - can't see why more sites don't use it.
andrew99 is offline
Reply With Quote
View Public Profile
 
Old 10-22-2009, 01:44 AM Re: Server side includes inside of includes?
mtishetsky's Avatar
King Spam Talker

Posts: 1,166
Name: Mike
Location: Mataro, Spain
Trades: 0
You know, html is hyper text markup language while php is fully functional programming language. Generally speaking, html page is the result of php script's work, that's why you don't see php in html code. Including files with includes is the most simple thing that php can do.
__________________
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 10-22-2009, 01:53 AM Re: Server side includes inside of includes?
Experienced Talker

Posts: 47
Name: Andrew
Trades: 0
Oh I know, php is powerful. I've done some crazy stuff with it (registration sites, etc), although I'm still missing some of the basics (as you can tell)
andrew99 is offline
Reply With Quote
View Public Profile
 
Old 10-22-2009, 05:05 AM Re: Server side includes inside of includes?
lizciz's Avatar
Ultra Talker

Posts: 330
Name: Mattias Nordahl
Location: Sweden
Trades: 0
And just as an extra tip, in case you didn't know already. For both the include() and require() functions there are equivalent functions that will only include pages once, include_once() and require_once(). So if you get caught up in big nested includes where two includes in turn includes the same page it will still only be included once. This would prevent error messages saying you're trying to define functions which already exists for example.

So this is good to use when including pages with functions in it, or classes.
__________________
596f75206d65616e20796f752063616e2061637475616c6c79 207265616420746869733f
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Reply     « Reply to Server side includes inside of includes?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11614 seconds with 13 queries