![]() | | ||||||||
| | #1 |
| copy and paste geek War Room Member Join Date: Jan 2005 Location: Calgary
Posts: 1,390
Thanks: 68
Thanked 168 Times in 140 Posts
|
W3schools mentions that you should always use the "requires because scripts should not continue after an error." I haven't seen this mentioned anywhere else. Is this something that doesn't make a gnat worth of difference? Also I have WAMP installed now. My first include wouldn't work but when I uploaded it to a host it worked fine. I tried to double click on the WampServer icon first, then on the .php page, but my include menu didn't show up. Tried quite a few times. Any idea about what I or my machine might be doing wrong? best wishes, lloyd .......__o .......\<, ....( )/ ( )... |
|
There are 10 types of people, those that understand binary and those that don't. The KimW WSO | |
| | |
| | #2 |
| Web Developer, IT Support War Room Member Join Date: Dec 2008 Location: Birmingham, UK
Posts: 513
Thanks: 10
Thanked 77 Times in 65 Posts
|
require() produces a fatal error if the file cannot be found, therefore stopping any further script execution include() produces a warning if the file cannot be found, but does not stop further script execution It's your choice which you use based on the scenario you're coding for - you wouldn't want to use include() if the file you're including has functions which you then later assume in your coding are available to call, otherwise you'll get a host of errors. |
| | |
| | |
| | #3 |
| HyperActive Warrior Join Date: Jan 2010 Location: Ontario, Canada
Posts: 279
Thanks: 1
Thanked 21 Times in 20 Posts
|
I use include(); Works like a charm! ![]() It's great to make w3 compliant code, but they go a bit crazy at times. I'm not really sure how these two will make any difference to your overall output. |
| | |
| | #4 |
| HyperActive Warrior War Room Member Join Date: Dec 2009 Location: Thunder Bay ON
Posts: 401
Thanks: 12
Thanked 42 Times in 36 Posts
|
Ya go with includes.
|
| | |
| | #5 | |
| Old Dog -- New Tricks Join Date: Jan 2010 Location: Florida
Posts: 19
Thanks: 1
Thanked 8 Times in 5 Posts
| Quote:
What if the include loads your navigation menu and it fails for some reason? Does your site become unusable as a result. If you want to differentiate between when you use include and require, I'd use this rule of thumb: If a failure results in cosmetic errors only, like a log or footer failing to load, no big deal. Use 'include' If the failure would result in the site not being usable, 'require' it. I just use require all the time, but that's my choice. Len | |
| | |
![]() |
|
| Tags |
| includes, php, requires |
| Thread Tools | |
| |
![]() |