RE: [PHP] More PHP Includes
-Original Message- From: Gary [mailto:gwp...@ptd.net] Sent: 11 March 2009 00:17 To: php-general@lists.php.net Subject: Re: [PHP] More PHP Includes Jochem Thanks for your reply, the project seven and DW was just for a point of information, same as if you have an issue with a computer you generally find it a good idea to list your operating system and other pertinent facts. I had coded the scripts and files by hand. The file was not on the server and it did not point back to my hard drive, it was hand coded and not uploaded to the server, which is why it was curious. The way I sometimes go about making a website is to fully code up the entire first page with a design I would like. Menus/headers/footers/layout and all. Then, when I'm happy with it, I cut it up into componant parts which I then include back in. This way there is no chance of having repeated tags, and everything is neatly organised. By the time you've cut it up, your index.php file will likely have nothing more than a bunch of includes and possibly the text specific to the index page. Don't think that each included file needs to work on its own. It doesn't matter if the included file doesn't open a tag if the page calling it has opened the tag already (such as html). I've had an include that formed part of a table, with the table created by a different included file, and closed by yet another. Jochem Maas joc...@iamjochem.com wrote in message news:49b6fddd.20...@iamjochem.com... Gary schreef: I'm sorry you were not able to understand the questions, but thank you for trying. a few tips: 1. don't assume people know what 'projectseven PMM' 2. it's doubtful anyone worth their salt on this list uses or knows much about a mind-bending, soul-destroyer like DreamWeaver. 3. try your hand at building a page by hand using a simple text editor and copious ammounts of searching/reading about HTML structure ... doing it this way will help you to understand what goes wrong and why, when DW tries to 'help you'. The path to the include is not an absolute path. then it is on the server, somewhere on your php include_path. Jochem Maas joc...@iamjochem.com wrote in message news:49b6b6d8.7050...@iamjochem.com... Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
On Wed, Mar 11, 2009 at 6:16 AM, Gary gwp...@ptd.net wrote: Jochem Thanks for your reply, the project seven and DW was just for a point of information, same as if you have an issue with a computer you generally find it a good idea to list your operating system and other pertinent facts. What Jochem told is true, IDEs like DW is good for mainly designers but could be a feeder for a matured man (coder). For IDE I support using something like Netbeans PDT. I had coded the scripts and files by hand. The way you asked about the files you included reflects you have some basic lack of understanding of the way they should look like /organized(not intended any slightest offense). But this discussion would open your eyes. The file where your include other files is rendered as a single HTML file so, think in that way, it would be just easy to understand. The file was not on the server and it did not point back to my hard drive, it was hand coded and not uploaded to the server, which is why it was curious. Yes this curiosity is really helpful. As I mentioned about the intrusion probability this way. Try collecting the ZCE exam Guide and you can study the 'Security' Chapter there. Jochem Maas joc...@iamjochem.com wrote in message news:49b6fddd.20...@iamjochem.com... Gary schreef: I'm sorry you were not able to understand the questions, but thank you for trying. a few tips: 1. don't assume people know what 'projectseven PMM' 2. it's doubtful anyone worth their salt on this list uses or knows much about a mind-bending, soul-destroyer like DreamWeaver. 3. try your hand at building a page by hand using a simple text editor and copious ammounts of searching/reading about HTML structure ... doing it this way will help you to understand what goes wrong and why, when DW tries to 'help you'. The path to the include is not an absolute path. then it is on the server, somewhere on your php include_path. Jochem Maas joc...@iamjochem.com wrote in message news:49b6b6d8.7050...@iamjochem.com... Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
At 9:59 AM -0400 3/10/09, Gary wrote: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? Gary: If you want to see how this all plays out in a demo, try this: http://sperling.com/examples/include-demo/ Go through the complete demo and you'll see how the header/footer/menu include things work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Again, thank you for everyone that offered their advice. Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Again, thank you for everyone that offered their advice. Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP includes
-Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: 09 March 2009 19:55 To: Mayer, Jonathan Cc: Gary; php-general@lists.php.net Subject: RE: [PHP] Re: PHP includes On Mon, 2009-03-09 at 15:10 +, Mayer, Jonathan wrote: Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). Thanks again for all your help. There are some circumstances where that could be useful. I don't do it often, but one site I made a while ago was based on a standard main page with the content included in. The content pages then had absolutely nothing except the unique text, so that redesigns to the site were made easier in the futurem, because only one page needed to be edited. So the entire site was based around a page.php?ID=x with the ID specifying the include required. Such as an example might be a little out of date now, what with CSS and so forth, but it was useful at the time. If I am including a file with password details, I usually make it something random (.inc, .sec, whatever) and hide it away somewhere inacessible Gary Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Best thing is usually to name files like this: filename.inc.php or some-such, and not filename.inc. Ash www.ashleysheridan.co.uk Thanks Ash - that's an excellent point which I'll remember next time I'm including! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP includes
Mayer, Jonathan wrote: Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Easily solveable by keeping your include files in a directory outside the web root. IE in a directory apache (or whatever server you use) does not serve. If you have any include files that have sensitive information (IE database username/password, the salt/algorithm you use to create a user password hash, etc.) then having an include directory outside the web root is a must anyway - with or without a .php extension on those files (if apache fails to load the php module for whatever reason on a restart, those .php files may be sent plain text). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More PHP Includes
Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
On Tue, Mar 10, 2009 at 7:59 PM, Gary gwp...@ptd.net wrote: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) If you think of the whole layout you know how to place the tags. that is there cant be two html tags or two body tags etc. So, it should be maintained well, that tags dont break and the html gets valid and you do have working and expected output. Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? As mentioned, for security reasons its not wise to include files without .php extentions. you should include like myincludefile.inc.php or sometext.txt.php etc. As you said you are allowing the txt file from outside the server, it is another security risk as well. allow_url_fopen lets this to open others file. But lets say the file is at the hand of a bad guy, and he modifies that with malicious code to intrude into your server. Please read php Security issues to know about them in details. CSRF, XSS, ClickJacking, Phishing, Code-injections, SQL injections etc etc etc. http://shiflett.org/ for PHP Web Security issues is a must read. also http://phpsec.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
I'm sorry you were not able to understand the questions, but thank you for trying. The path to the include is not an absolute path. Jochem Maas joc...@iamjochem.com wrote in message news:49b6b6d8.7050...@iamjochem.com... Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: More PHP Includes
On Tue, 10 Mar 2009 09:59:53 -0400, gwp...@ptd.net (Gary) wrote: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) The main file should set up the page (head, body, etc). The include file can have any mixture of HTML and PHP, including defining tables, etc. If it contains any PHP it should be named as x.php. It is also good practice to put ?php at the start, and ? at the end, though it doesn't appear to make any difference. Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? Sorry; I don't understand this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
Gary schreef: I'm sorry you were not able to understand the questions, but thank you for trying. a few tips: 1. don't assume people know what 'projectseven PMM' 2. it's doubtful anyone worth their salt on this list uses or knows much about a mind-bending, soul-destroyer like DreamWeaver. 3. try your hand at building a page by hand using a simple text editor and copious ammounts of searching/reading about HTML structure ... doing it this way will help you to understand what goes wrong and why, when DW tries to 'help you'. The path to the include is not an absolute path. then it is on the server, somewhere on your php include_path. Jochem Maas joc...@iamjochem.com wrote in message news:49b6b6d8.7050...@iamjochem.com... Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
Jochem Thanks for your reply, the project seven and DW was just for a point of information, same as if you have an issue with a computer you generally find it a good idea to list your operating system and other pertinent facts. I had coded the scripts and files by hand. The file was not on the server and it did not point back to my hard drive, it was hand coded and not uploaded to the server, which is why it was curious. Jochem Maas joc...@iamjochem.com wrote in message news:49b6fddd.20...@iamjochem.com... Gary schreef: I'm sorry you were not able to understand the questions, but thank you for trying. a few tips: 1. don't assume people know what 'projectseven PMM' 2. it's doubtful anyone worth their salt on this list uses or knows much about a mind-bending, soul-destroyer like DreamWeaver. 3. try your hand at building a page by hand using a simple text editor and copious ammounts of searching/reading about HTML structure ... doing it this way will help you to understand what goes wrong and why, when DW tries to 'help you'. The path to the include is not an absolute path. then it is on the server, somewhere on your php include_path. Jochem Maas joc...@iamjochem.com wrote in message news:49b6b6d8.7050...@iamjochem.com... Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes
At 1:06 PM -0400 3/8/09, Gary wrote: I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary Gary: A demo might help: http://sperling.com/examples/include-demo/ As for SEO, includes neither help nor hurt. Includes deliver code as requested for both bot and human alike. They are completely transparent to whatever/whomever are requesting them. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes
I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. hi Gary, It doesn't matter to SEO because search engines and the bots reads the output of your php scripts. whatever you see when you browse your page, same thing bots would see. Includes is a way to modularize your scripts instead of monolithic or repeated codes everywhere in your php file. Virgil http://www.jampmark.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes
Virgilio Quilario wrote: I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. hi Gary, It doesn't matter to SEO because search engines and the bots reads the output of your php scripts. whatever you see when you browse your page, same thing bots would see. Includes is a way to modularize your scripts instead of monolithic or repeated codes everywhere in your php file. Virgil http://www.jampmark.com everybody is correct, include = server side include - all happens on the server, client never knows -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). Thanks again for all your help. Gary Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP includes
Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). Thanks again for all your help. There are some circumstances where that could be useful. I don't do it often, but one site I made a while ago was based on a standard main page with the content included in. The content pages then had absolutely nothing except the unique text, so that redesigns to the site were made easier in the futurem, because only one page needed to be edited. So the entire site was based around a page.php?ID=x with the ID specifying the include required. Such as an example might be a little out of date now, what with CSS and so forth, but it was useful at the time. If I am including a file with password details, I usually make it something random (.inc, .sec, whatever) and hide it away somewhere inacessible Gary Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP includes
From: Gary Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). We include template files for the head block, a banner across the top of every page, the footer across the bottom, the menu and images in the left sidebar, and the advertisement banners across the top and bottom. Even the core section of each page is included from the initial file. That way we can change the appearance, or modify the links to our disclaimers and help files just once and every page gets updated. We also have configuration flags to prevent some of those files from being included in a specific virtual domain, so our clients can provide their own templates instead of using ours. File extensions for includes are up to you. Just make sure your IDE/Editor know that they are PHP files. We use .lia for the libraries of functions we use throughout the site. None of our files have .php as the extension. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP includes
Gary wrote: Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? There are several advantages of using include. I can't imagine an application without include/require/autoload. I create the database adapter only once per request. I store several application configuration items in a config file and load this configuration information only once per request. I have one layout for the application. Only the content and the menus change. So, I would simply include various sections of the web page in relevant positions. Example: layout.php ?php include 'header.php'; include 'menu.php'; // menu.php is also dynamic. menu.php determines what to display on the current page. include 'sidebar.php'; // within sidebar.php I would include block_a.php, block_b.php, etc include 'footer.php'; ? I put the utility functions and classes in a library file. I would simply include the library.php and use the functions available in it. I hope you get the point of using include. What is the best type of file to be used as an include (.txt, .php). -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Gary wrote: Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). Thanks again for all your help. Gary Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary Hi Gary, I think this thread is at risk of getting confusing and not addressing the problem at its root. An include is typically used to allow storing reusable code in a file all by itself, this could be a settings (config) file, a class, an html template or whatever - purpose being of course to keep you all nice and organised, with each thing in its place. Leaving out everything else and focusing only on why we'd use include/require in an application, let's take a simple example: Simple PHP Site with 3 Pages. 1 - / (the homepage) 2 - /?page=about (the about us page) 3 - /?page=contact (the contact us page) in the above scenario then your index.php could look like this ?php //set the default page to be home $page = 'home'; //check if a page has been specified if( isset($_GET['page']) ) { $page = $_GET['page']; } if( $page == 'home' ) { include 'home.php'; } elseif ( $page == 'about' ) { include 'about.php'; } else( $page == 'contact' ) { include 'contact.php'; } else { include 'page-not-found.php'; } ? very simple, but works; now let's expand it a bit.. in a real world scenario we probably have a good chunk of script at the top of index.php that holds database settings, database connection etc. and in each of our pages we probably have much of the html repeated (site header, footer, navigation) - we can then abstract these in to there own files to keep it all nice and clean.. as such ?php $page = 'home'; if( isset($_GET['page']) ) { $page = $_GET['page']; } // get site database settings require 'config.php'; // get our database class require 'classes/class.database.php'; // start out database $database = new DatabaseClass($settings_from_config); // load the site header include 'templates/header.php'; // load the content for the requested page if( $page == 'home' ) { include 'content/home.php'; } elseif ( $page == 'about' ) { include 'content/about.php'; } else( $page == 'contact' ) { include 'content/contact.php'; } else { include 'content/page-not-found.php'; } // load the site footer include 'templates/footer.php'; ? now everything is in its rightful place and we have lots of easy files to work with, for example now you can let a designer work on the about.php page knowing that they won't be able to break the whole application, as it's just a bit of html content. also, you can now change the header image in one file (templates/header.php) and the whole site will update. most PHP websites are simply far more complex versions of the above, look complicated but the principals are the same. now the only thing I didn't cover is which to use.. it's often the case that require_once and include_once should be used over include and require; because in most cases (certainly with classes) you just want to ensure the code is available. both of the _once statements will only load the file if it hasn't been already, thus ensuring no errors such as class already defined because it's already been included! On the other hand if the code in the file has been designed to be used many times on a page then include would be the better choice - a really stupid example but consider a file containing a fancy horizontal bar; you may want to include this many times on a page. Finally, require and require_once will kill the script with an error if the file isn't found, whereas include will throw an error and simply keep on going if the files isn't found. Think that covers everything in the scope of this :) Regards! Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Gary wrote: Thank you to everybody that replied...but it almost seems it is making extra work. What is the best type of file to be used as an include (.txt, .php). new I forgot something! the best type of file to be used as an include differs on a case by case basis. name the files correctly and forget about dictating in advance, file extensions are there so people can easily identify what's in the file - and when you have 10,000 files you'll really appreciate this :p some_code.php some_html.html some_text.txt all of them can be included, and even reading the list you can pretty much guess what each contains. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP includes
On Mon, 2009-03-09 at 15:10 +, Mayer, Jonathan wrote: Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). Thanks again for all your help. There are some circumstances where that could be useful. I don't do it often, but one site I made a while ago was based on a standard main page with the content included in. The content pages then had absolutely nothing except the unique text, so that redesigns to the site were made easier in the futurem, because only one page needed to be edited. So the entire site was based around a page.php?ID=x with the ID specifying the include required. Such as an example might be a little out of date now, what with CSS and so forth, but it was useful at the time. If I am including a file with password details, I usually make it something random (.inc, .sec, whatever) and hide it away somewhere inacessible Gary Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Best thing is usually to name files like this: filename.inc.php or some-such, and not filename.inc. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP includes
Ashley Sheridan wrote: Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Best thing is usually to name files like this: filename.inc.php or some-such, and not filename.inc. v well said - one thing you never want is your source showing! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP includes
On Monday 09 March 2009 3:07:17 pm Nathan Rixham wrote: Ashley Sheridan wrote: Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Best thing is usually to name files like this: filename.inc.php or some-such, and not filename.inc. v well said - one thing you never want is your source showing! Unless you're working in open source and then the source is showing anyway from the original download site. And if simply knowing your source code is a security hole, then you have bad software. Your config file with passwords and such, sure, keep that locked down tight. But don't rely on security through obscurity. -- Larry Garfield la...@garfieldtech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP includes
On Mon, 2009-03-09 at 15:23 -0500, Larry Garfield wrote: On Monday 09 March 2009 3:07:17 pm Nathan Rixham wrote: Ashley Sheridan wrote: Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Best thing is usually to name files like this: filename.inc.php or some-such, and not filename.inc. v well said - one thing you never want is your source showing! Unless you're working in open source and then the source is showing anyway from the original download site. And if simply knowing your source code is a security hole, then you have bad software. Your config file with passwords and such, sure, keep that locked down tight. But don't rely on security through obscurity. -- Larry Garfield la...@garfieldtech.com I was talking about includes that have things such as database connection information and other sensitive things. By making it a PHP file, you prevent the code from being seen, ergo you hide your password, etc. phpMyAdmin does it this way, using a config.inc.php file for holding the connection information to each database. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP includes
I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes
Gary wrote: I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? It really does not matter to search engines and bots. They see the output of your PHP scripts not the code. They won't know whether your PHP script used include. Just the way you see web pages with some content and not the PHP code that generated it. Any and all comments would be appreciated. Gary -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes
Right. There are several advantages to using included files. You can write routines that you're going to use repeatedly and just include the file with the code, instead of re-inventing the wheel, as they say. Consistency is another advantage. So, if you design your header, sidebar and footer and just include them then you don't need to edit every stinking page on your site when you want to make a change. There's a handful of include-type statements. Include, include_one, require, require_once, etc. I'd read about those four before making a choice about which to use. On Sun, Mar 8, 2009 at 12:06 PM, Gary gwp...@ptd.net wrote: I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes only if required?
On Mon, Feb 2, 2009 at 6:42 AM, Edmund Hertle farn...@googlemail.com wrote: Hey, normally I prefer to do all my includes (classes + config files) at the beginning if my php files. But recently I thought about including some classes only if they are needed later in my code (like pear Mail and Mail_mime only if an e-mail is about to be sent) because of speed issues. So my question: Is this something I should consider? Or is it something I normally will not notice? -eddy Look at spl_autoload_register. -- http://www.voom.me | EFnet: #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes only if required?
Hey, normally I prefer to do all my includes (classes + config files) at the beginning if my php files. But recently I thought about including some classes only if they are needed later in my code (like pear Mail and Mail_mime only if an e-mail is about to be sent) because of speed issues. So my question: Is this something I should consider? Or is it something I normally will not notice? -eddy
Re: [PHP] Includes only if required?
Hi, Mail_mime Ooh... only if an e-mail is about to be sent) because of speed issues. So my question: Is this something I should consider? Or is it something I normally will not notice? Depends on the load on your server. If you're getting a billion requests per second, then it may well be cause for concern. Either way you can define a function called __autoload that gets called when a class is about to be instantiated. This function can then load the correct library. On demand as it were. http://uk2.php.net/__autoload -- Richard Heyes HTML5 Graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question About PHP Includes
Hi, I help maintain a Movable Type install for a non-profit organization. Things have worked well with the site but the other day the home page went blank and the rest of the pages lost all of their formatting. I've done some debugging and it seems that some include statements are no longer working. Here is the code: ?php ini_set(open_basedir,ini_get(include_path).:/some/absolute/path/to/httpdocs); ini_set(include_path,ini_get(include_path).:/some/absolute/path/to/httpdocs/Includes); $title = 'Some Non-Profit'; @include('header.inc'); $rawevents= implode(\n, file('//some/absolute/path/to/httpdocs/Includes/home_include-events')); $events = stripmtpara($rawevents); ? !-- * MAIN CONTENT SECTION ** -- ?php @include('homeheader.inc'); ? This code has worked forever so I'm not sure what's up. Based on my debugging I've found that: 1. The lines starting with $rawevents and $events, when commented out, allow the page to be rendered, but without the header information. 2. If I change the absolute paths in the ini_set statements to be relative paths I get my header information. I'm stumped...any ideas? I'm running PHP 5.2.5. Thanks! Jon -- View this message in context: http://www.nabble.com/Question-About-PHP-Includes-tp16467560p16467560.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question About PHP Includes
On Thu, Apr 3, 2008 at 11:22 AM, jwynacht [EMAIL PROTECTED] wrote: Hi, I help maintain a Movable Type install for a non-profit organization. Things have worked well with the site but the other day the home page went blank and the rest of the pages lost all of their formatting. I've done some debugging and it seems that some include statements are no longer working. Here is the code: ?php ini_set(open_basedir,ini_get(include_path).:/some/absolute/path/to/httpdocs); ini_set(include_path,ini_get(include_path).:/some/absolute/path/to/httpdocs/Includes); $title = 'Some Non-Profit'; @include('header.inc'); [snip!] Have you tried removing error buffering on the include() statement? Just remove the @ and see if there's any errors output on the screen or to the log. -- /Daniel P. Brown Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Just ask! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question About PHP Includes
On Thu, Apr 3, 2008 at 11:42 AM, Jon Wynacht [EMAIL PROTECTED] wrote: Hi Dan, I just tried that and didn't see any errors on the screen or in my log file. I'm really quite stumped and am wondering if my ISP made some changes on their end? Thanks, Jon Please keep all replies on-list, Jon, so others may benefit when searching the web and the archives. If you're on a shared host, that is most likely the reason it's happening: your host likely made a change without informing you. Since you can get everything to work with relative paths, but not absolute paths, it sounds like your account has been chroot'd. If you can't use relative paths for some reason, try speaking with your host to have the chroot (jail) removed for that account. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question About PHP Includes
Whoopssorry abut the reply ;-( Thanks for the advice...I'll start making the changes in the path. Cheers, Jon On Apr 3, 2008, at 8:56 AM, Daniel Brown wrote: On Thu, Apr 3, 2008 at 11:42 AM, Jon Wynacht [EMAIL PROTECTED] wrote: Hi Dan, I just tried that and didn't see any errors on the screen or in my log file. I'm really quite stumped and am wondering if my ISP made some changes on their end? Thanks, Jon Please keep all replies on-list, Jon, so others may benefit when searching the web and the archives. If you're on a shared host, that is most likely the reason it's happening: your host likely made a change without informing you. Since you can get everything to work with relative paths, but not absolute paths, it sounds like your account has been chroot'd. If you can't use relative paths for some reason, try speaking with your host to have the chroot (jail) removed for that account. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes eating up my time [SOLVED]
David, Thank you for responding. __autoload ... which basically only loads classes when they are required. Yes, this is exactly what I needed. Not only was I already on PHP5, but fortunately I had also already been building my classes so that it was one class per file, as __autoload requires. So this was possibly the easiest and most effective change I've ever implemented. And the results were impressive. The Zend profiler reported that I went from 500 to 800 milliseconds per page request down to 40 to 60 milliseconds. Occasional database connections raised the time now and again, but I think I have a handle on that. Thank you for pointing that out to me. Just the right solution. -- Dave M G Ubuntu Feisty 7.04 Kernel 2.6.20-16-386 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes eating up my time
PHP general list, This is probably obvious to people who are good at PHP, but I'm I have a PHP based CMS (content management system) built, which has grown and become quite robust. It's now spread out over about 30 files, and each file represents one class within the object oriented design. Each are a couple hundred lines of code, and two or three of the most critical classes are over a thousand lines of code. While first building it, I didn't really anticipate quite that many files. What I did is have a file called includes.php, which list all the files to be included. Then I in turn included includes.php at the beginning of my index.php file. Every page request passes through the index.php file, so that basically means every single file is included at the start of every new page request. I'm using Zend Studio, which has a profile option, which shows how long it takes for my PHP scripts to complete a request. It has a breakdown showing percentages of which scripts are using that processing time. Currently, my processes are taking under a second, but they can be around half a second or more. Although it all happens too fast for me to really notice as a person, it seems to me that a half second of processing time might be kind of long and lead to scalability problems. My first question is: Is a half second too long? I'm pretty sure it is, but maybe I'm just being paranoid. What do people consider to be acceptable time frames for processing a web page similar to what Wikipedia delivers? Most of the time is taken with the includes. Anywhere from 60% to 90% of the time it takes to process my scripts is coming from the includes.php file. I read somewhere that it's not a good idea to have more than 10 includes in any one place. I'm fine with trying to break up my include requests, but I'm unsure as to how. As each function in each class passes around objects, it's not clear from looking at the code which ones are used at any one time, so I'm unsure how to efficiently include only the necessary classes. My second question is: Is there a systematic way of determining how to incrementally include files that people use? Or is it just a constant process of testing and checking? Thank you for any advice. -- Dave M G Ubuntu Feisty 7.04 Kernel 2.6.20-16-386 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes eating up my time
Hi Dave, PHP general list, This is probably obvious to people who are good at PHP, but I'm I have a PHP based CMS (content management system) built, which has grown and become quite robust. It's now spread out over about 30 files, and each file represents one class within the object oriented design. Each are a couple hundred lines of code, and two or three of the most critical classes are over a thousand lines of code. It may just be a 'dave' thing but my stuff does that too :-) While first building it, I didn't really anticipate quite that many files. What I did is have a file called includes.php, which list all the files to be included. Then I in turn included includes.php at the beginning of my index.php file. Every page request passes through the index.php file, so that basically means every single file is included at the start of every new page request. Ahh the 'dave' thing returns :-) I'm using Zend Studio, which has a profile option, which shows how long it takes for my PHP scripts to complete a request. It has a breakdown showing percentages of which scripts are using that processing time. Real dave's use vi top :-P My second question is: Is there a systematic way of determining how to incrementally include files that people use? Or is it just a constant process of testing and checking? Thank you for any advice. What version of PHP are you using ? I moved over to 5 and it has a nice cute feature :- http://uk3.php.net/__autoload which basically only loads classes when they are required. PHP 5 has some other nice to have features and will cause you a bit of work if you migrate to it BUT it is worth the effort especially in the light of 888 :-) As for your performance problems, the times are heavily dependant on the hardware and underlying OS server load etc. without further info, diagnosing problems will be dificult. TTFN Dave php/general-2007-07-31.tx php-general [EMAIL PROTECTED] ++ | Dave Restall, Computer Nerd, Cyclist, Radio Amateur G4FCU, Bodger | | Mob +44 (0) 7973 831245 Skype: dave.restall Radio: G4FCU | | email : [EMAIL PROTECTED] Web : Not Ready Yet :-( | ++ | Big book, big bore.| | -- Callimachus | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes eating up my time
Dave M G wrote: Currently, my processes are taking under a second, but they can be around half a second or more. Although it all happens too fast for me to really notice as a person, it seems to me that a half second of processing time might be kind of long and lead to scalability problems. That's hardly the worst performance I've seen from a CMS, but you should know that nearly all CMS systems are slow, many slower than this, for similar reasons. The solution is usually to build a front-end cache, either in the CMS itself or using an external tool. For instance, MODx caches internally, while others rely on Apache/Enfold/etc. My first question is: Is a half second too long? I'm pretty sure it is, but maybe I'm just being paranoid. What do people consider to be acceptable time frames for processing a web page similar to what Wikipedia delivers? When you quote Wikipedia, you do realize that they're not a CMS, right, that they're a Wiki? There are some subtle differences. I haven't looked at Wikipedia's Wiki code (I like TWiki) but the Wikis I've used don't actually use a database or a billion classes to get their work done. They're more focused on editing an entire page of static content, which is stored on disk (and thus directly accessible by the server). If you want that kind of scalability you also MUST implement some sort of caching. PHP is a scripting language, and no scripting language will ever keep up with compiled code, no matter how good (and PHP is good). You might also consider looking at the Zend Optimizer - I've never tried it, but have heard good things. My second question is: Is there a systematic way of determining how to incrementally include files that people use? Or is it just a constant process of testing and checking? PHP does have an auto-include system called the autoloader. We use this heavily in Blackbird ESB to load classes on the fly when they're referenced. It only works for loading classes, but since you say that's what you have... Take a look here: http://us.php.net/autoload Regards, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes eating up my time
On Tuesday 31 July 2007, Dave M G wrote: PHP general list, This is probably obvious to people who are good at PHP, but I'm I have a PHP based CMS (content management system) built, which has grown and become quite robust. It's now spread out over about 30 files, and each file represents one class within the object oriented design. Each are a couple hundred lines of code, and two or three of the most critical classes are over a thousand lines of code. While first building it, I didn't really anticipate quite that many files. What I did is have a file called includes.php, which list all the files to be included. Then I in turn included includes.php at the beginning of my index.php file. Every page request passes through the index.php file, so that basically means every single file is included at the start of every new page request. Yep, that's the downside of a shared-nothing architecture. Initialization gets slower. Possible solutions include: - If you're using all classes, use PHP 5's __autoload() or better still spl_autoload_register() to load classes on demand instead of all at once. - Refactor your code to conditionally include code only when needed. E.g., you probably only need one page handler loaded per page request. I'm in the process of doing that for Drupal right now and the savings are quite substantial. - Op code cache. This is exactly where an op code cache will get you the biggest win, by saving you the loading and parsing time. - Page caching. To do page caching best, you should have the system do a partial bootstrap, check to see if it can serve a page from the cache, do so if it can, and if it can't only then finish loading the rest of the system. That way you skip most of the loading process on cached requests. - Some combination of the above. I'd do the op code cache last, as that's a sure-fire easy win while the others take effort. So do those first, and then whatever's left you can throw an op code cache at for an extra boost. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes, Require, Location, Other
Hi, If I were to have something like the following, what is the best way (or best practice) to reload the page and display the error - or is there a better way to do this. I want to keep the site uniform and don't want errors popping up and making a mess. Thanks B - $query = select idn, name from manager order by name; $results = mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { $error = $table_error$mysqlerror; include(season.php); - This is not what I really want and in some cases it cause problems. exit; } else { The rest of the code } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes, Require, Location, Other
A couple of things. 1) Delay your output to the very end. That way you can still do page redirects and build whole new pages depending on the errors you get. 2) Store errors in the session, then when building the page have a place for put any error messages here, then delete them from the session. 3) Better yet, use PHP's set_error_handler() features to break out of the flow of the page completely when necessary. You can do a lot more error checking that way, and it makes the code cleaner to boot. 4) Structure your code so that you can't send malformed SQL in the first place. :-) If you're writing a static query, test it before it goes live (duh). If it's a dynamic query, structure it in such a way that it can't not be valid. (There's lots of ways do to that. I find arrays and implode() to work well for me.) At worst you'll return an empty result set, which is not an error but in fact a genuine situation you should be accounting for anyway. What you're doing below is really just a fancy version of mysql_query() or die, which I've always felt is very sloppy code. On Sunday 18 June 2006 10:33, Beauford wrote: Hi, If I were to have something like the following, what is the best way (or best practice) to reload the page and display the error - or is there a better way to do this. I want to keep the site uniform and don't want errors popping up and making a mess. Thanks B - $query = select idn, name from manager order by name; $results = mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { $error = $table_error$mysqlerror; include(season.php); - This is not what I really want and in some cases it cause problems. exit; } else { The rest of the code } -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes and paths confusion
On Fri, April 28, 2006 3:09 am, Nick Wilson wrote: [EMAIL PROTECTED] ls ads/ config.inc db.inc funcs.inc init.inc where ads/ is a whole huge set of scripts from an existing setup. ads/ was originally placed on its own domain as it's a version of phpadsnew and runs as a server all by itself. Whoever wrote phpadsnew assumed you don't understand PHP's include_path, so they tried to be smart and used relative paths. But that ONLY works if you install everything in exactly the same structure as they thought you should. :-( I moved ads/ to this directory to try to troubleshoot and make things clearer. db.inc has these lines: require_once(ads/admin/config.php); require_once(lib-statistics.inc.php); require_once(lib-zones.inc.php); require_once(config.inc.php); require_once(lib-db.inc.php); require_once(lib-dbconfig.inc.php); warning: main(../config.inc.php): failed to open stream: No such file or directory in /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php on line 33. Fatal error: main(): Failed opening required '../config.inc.php' (include_path='.:/usr/lib/php') in /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php on line 33 So, the ads/admin/config.php is looking for '../config.inc.php' which is not there. But it's getting called, as far as we can tell from what you have posted, from ads/db.inc, in which case the correct path would just be 'config.inc.php', since the base path of db.inc is /ads/ and that's where 'config.inc.php' is... It seems awfully odd that db.inc would require 'ads/admin/config.php' in the first place, tell you the truth... So, why does this not happen when ads/ is on its own domain? I can see it has something to do with relative paths, but even when i try to work with chdir() i still get no joy. I don't think chdir() affects where PHP and include_path look for include files... I just can't figure out what the issue may be, so any pointers in the right direction would be hugely appreciated. I think the first thing I would do would be to make sure that you restore the code to what is on the other server. THEN, change your include_path within /ads to be: '.:/var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads' AND, change your include_path within /ads/admin to be: '.:/var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin' Oh! It's possible, even LIKELY, that when you copied the files over, you missed copying over the .htaccess files that did this for you from the other server -- because files named with a leading '.' are ignored by many command line tools (tar, cp, etc) unless you specifically include them with command flags or list them by name as filenames. If you are just missing the .htaccess files, just copy those over, and undo any changes you've been making to try and fix the problem. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes and paths confusion
Hello all, Im having some problems understanding why some requires() are failing. Let me see if i can describe what's going on clearly... I have this: [EMAIL PROTECTED] ls ads/ config.inc db.inc funcs.inc init.inc where ads/ is a whole huge set of scripts from an existing setup. ads/ was originally placed on its own domain as it's a version of phpadsnew and runs as a server all by itself. I moved ads/ to this directory to try to troubleshoot and make things clearer. db.inc has these lines: require_once(ads/admin/config.php); require_once(lib-statistics.inc.php); require_once(lib-zones.inc.php); require_once(config.inc.php); require_once(lib-db.inc.php); require_once(lib-dbconfig.inc.php); warning: main(../config.inc.php): failed to open stream: No such file or directory in /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php on line 33. Fatal error: main(): Failed opening required '../config.inc.php' (include_path='.:/usr/lib/php') in /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php on line 33 So, why does this not happen when ads/ is on its own domain? I can see it has something to do with relative paths, but even when i try to work with chdir() i still get no joy. I just can't figure out what the issue may be, so any pointers in the right direction would be hugely appreciated. thankyou! -- Nick Wilson Tel:+45 3311 2250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes and paths confusion
Nick Wilson wrote: Hello all, Im having some problems understanding why some requires() are failing. Let me see if i can describe what's going on clearly... I have this: [EMAIL PROTECTED] ls ads/ config.inc db.inc funcs.inc init.inc where ads/ is a whole huge set of scripts from an existing setup. ads/ was originally placed on its own domain as it's a version of phpadsnew and runs as a server all by itself. I moved ads/ to this directory to try to troubleshoot and make things clearer. db.inc has these lines: use something *like* the following: $oldincpath = ini_get('include_path'); ini_set('include_path', 'path/to/ads/stuff:etc'); // do your 'ads' requires ini_set('include_path', $oldincpath); also look into the magic constant __FILE__ and the functions dirname() and realpath(). read the manual regard how to use 'include_path' have fun. require_once(ads/admin/config.php); require_once(lib-statistics.inc.php); require_once(lib-zones.inc.php); require_once(config.inc.php); require_once(lib-db.inc.php); require_once(lib-dbconfig.inc.php); warning: main(../config.inc.php): failed to open stream: No such file or directory in /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php on line 33. Fatal error: main(): Failed opening required '../config.inc.php' (include_path='.:/usr/lib/php') in /var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php on line 33 So, why does this not happen when ads/ is on its own domain? I can see it has something to do with relative paths, but even when i try to work with chdir() i still get no joy. I just can't figure out what the issue may be, so any pointers in the right direction would be hugely appreciated. thankyou! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes and paths confusion
* and then Jochem Maas declared Nick Wilson wrote: Hello all, Im having some problems understanding why some requires() are failing. Let me see if i can describe what's going on clearly... I have this: [EMAIL PROTECTED] ls ads/ config.inc db.inc funcs.inc init.inc where ads/ is a whole huge set of scripts from an existing setup. ads/ was originally placed on its own domain as it's a version of phpadsnew and runs as a server all by itself. I moved ads/ to this directory to try to troubleshoot and make things clearer. db.inc has these lines: use something *like* the following: $oldincpath = ini_get('include_path'); ini_set('include_path', 'path/to/ads/stuff:etc'); // do your 'ads' requires ini_set('include_path', $oldincpath); Unfortunately that's pretty much the same thing we tried first on this. Even with the include path set to include every directory that contains a script we need to access, the same error happens. also look into the magic constant __FILE__ and the functions dirname() and realpath(). read the manual regard how to use 'include_path' No, the ideal is to not touch the config.php file or any of the other required files (otherwise we may just aswell write our own) so those functions and the __FILE__ constant are not usable. Unless i miss your point? thanks -- Nick Wilson Tel:+45 3311 2250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes and paths confusion
Nick Wilson wrote: * and then Jochem Maas declared Nick Wilson wrote: ... use something *like* the following: $oldincpath = ini_get('include_path'); ini_set('include_path', 'path/to/ads/stuff:etc'); // do your 'ads' requires ini_set('include_path', $oldincpath); Unfortunately that's pretty much the same thing we tried first on this. Even with the include path set to include every directory that contains a script we need to access, the same error happens. check directory permission, check the include_path is being set, check the include path is actually correct (I take it you have a good understanding how include_path works). also look into the magic constant __FILE__ and the functions dirname() and realpath(). read the manual regard how to use 'include_path' No, the ideal is to not touch the config.php file or any of the other I would say fix the config file so that it can figure out where everything is regardless of whether your using a vhost or stuck in subdir of some other vhost. but thats just me :-) required files (otherwise we may just aswell write our own) so those functions and the __FILE__ constant are not usable. maybe set a 'auto_prepend' directive via an .htaccess declaration in the relevant dir? Unless i miss your point? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes and paths confusion
* and then Jochem Maas declared check directory permission, check the include_path is being set, check the include path is actually correct (I take it you have a good understanding how include_path works). Good call on dir perms, but yes, they appear to be fine. I *think* i have a good understanding of include_path but here's the error which quotes the include path so you/others can tell me for sure: Fatal error: main(): Failed opening required '../config.inc.php' (include_path='/var/www/localhost/vhosts/ads.communicontent.com/:/var/www/localhost/vhosts/ads.communicontent.com/admin:/var/www/localhost/vhosts/ads.communicontent.com/libraries:/var/www/localhost/vhosts/ads.communicontent.com/libraries/resources') in /var/www/localhost/vhosts/ads.communicontent.com/admin/config.php on line 34 and here's the line that sets it: ini_set('include_path', PARTNERS_MAX_PATH.':'.PARTNERS_MAX_PATH.'admin'.':'.PARTNERS_MAX_PATH.'libraries'.':'.PARTNERS_MAX_PATH.'libraries/resources'); and the definition of the constant in there: // where max is installed (include / ) define(PARTNERS_MAX_PATH,/var/www/localhost/vhosts/ads.communicontent.com/); also look into the magic constant __FILE__ and the functions dirname() and realpath(). read the manual regard how to use 'include_path' No, the ideal is to not touch the config.php file or any of the other I would say fix the config file so that it can figure out where everything is regardless of whether your using a vhost or stuck in subdir of some other vhost. but thats just me :-) Ordinarily i'd agree. We want to be able to update this set of third party maintained scripts easily though, hence writing a layer to interact with it rather than hack the core code. Hope that all makes sense! thanks -- Nick Wilson Tel:+45 3311 2250 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes and paths confusion
dirs named in include_path should not have a slash at the end. and don't forget to include the DOT as one of your include pathes e.g. ini_set('include_path', '.:/the/rest'); can you send the list of requires you do [again] (and state where the files are actually living on disk) - I'm on 3 hours of sleep here so help me to help you kind of thing. also try doing it with an 'include' iso a 'require' - might give you a different [more helpful] error. Nick Wilson wrote: * and then Jochem Maas declared check directory permission, check the include_path is being set, check the include path is actually correct (I take it you have a good understanding how include_path works). I often think along those lines - 5 seconds later I often get a bite in the ass ;-) Good call on dir perms, but yes, they appear to be fine. I *think* i have a good understanding of include_path but here's the error which quotes the include path so you/others can tell me for sure: Fatal error: main(): Failed opening required '../config.inc.php' (include_path='/var/www/localhost/vhosts/ads.communicontent.com/:/var/www/localhost/vhosts/ads.communicontent.com/admin:/var/www/localhost/vhosts/ads.communicontent.com/libraries:/var/www/localhost/vhosts/ads.communicontent.com/libraries/resources') in /var/www/localhost/vhosts/ads.communicontent.com/admin/config.php on line 34 and here's the line that sets it: ini_set('include_path', PARTNERS_MAX_PATH.':'.PARTNERS_MAX_PATH.'admin'.':'.PARTNERS_MAX_PATH.'libraries'.':'.PARTNERS_MAX_PATH.'libraries/resources'); and the definition of the constant in there: // where max is installed (include / ) define(PARTNERS_MAX_PATH,/var/www/localhost/vhosts/ads.communicontent.com/); also look into the magic constant __FILE__ and the functions dirname() and realpath(). read the manual regard how to use 'include_path' No, the ideal is to not touch the config.php file or any of the other I would say fix the config file so that it can figure out where everything is regardless of whether your using a vhost or stuck in subdir of some other vhost. but thats just me :-) Ordinarily i'd agree. We want to be able to update this set of third party maintained scripts easily though, hence writing a layer to interact with it rather than hack the core code. Hope that all makes sense! thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting or Getting Relative Path for PHP Includes
Anthony Baker wrote: I often use PHP includes in my files to pull in assets, but I hard code the relative path to the root html directory for the sites that I'm working on in each file. Example below: While I happen to think using include_path and $_SERVER is a better solution to setting up your environment, what you describe as what you want more closely fits php.ini's auto_prepend_file and nobody has suggested that yet. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting or Getting Relative Path for PHP Includes
* Thus wrote Anthony Baker: Hey Folks, Hoping someone can aid me with a newbie-ish question. I often use PHP includes in my files to pull in assets, but I hard code the relative path to the root html directory for the sites that I'm working on in each file. Example below: ?php $path = '/home/virtual/sitename.com/var/www/html/'; //relative path to the root directory $inc_path = $path . 'code/inc/'; //path and folder the code includes folder is located $copy_path = $path . 'copy/'; //path and folder the copy is located ? I'd like to be able to set the relative path as a global variable from an external file so that I can modify one line of code to change the relative path across the site. This will allow me for easier coding in staging and development environments. This is a good use of the define() function, what I would generally do is create a config.php of some sort with: ?php define('_BASE_INCLUDE_', '/home/path/'); define('_INCLUDE_INC_', _BASE_INCLUDE_ . 'code/inc/'); define('_INCLUDE_CPY_', _BASE_INCLUDE_ . 'code/copy/'); ? And each file that needs this config: ?php require_once('config.php'); // having config.php in your // php_include_path ? Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Setting or Getting Relative Path for PHP Includes
Hey Folks, Hoping someone can aid me with a newbie-ish question. I often use PHP includes in my files to pull in assets, but I hard code the relative path to the root html directory for the sites that I'm working on in each file. Example below: ?php $path = '/home/virtual/sitename.com/var/www/html/'; //relative path to the root directory $inc_path = $path . 'code/inc/'; //path and folder the code includes folder is located $copy_path = $path . 'copy/'; //path and folder the copy is located ? I'd like to be able to set the relative path as a global variable from an external file so that I can modify one line of code to change the relative path across the site. This will allow me for easier coding in staging and development environments. What's the best way to do so? Can anyone provide a code example? Either that, or is there a way to call this variable from the server itself so that it's automatically -- and correctly -- set? Thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting or Getting Relative Path for PHP Includes
On Tuesday 21 December 2004 04:41, Anthony Baker wrote: Either that, or is there a way to call this variable from the server itself so that it's automatically -- and correctly -- set? Use a combination of one or more items from $_SERVER. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I think if you say you're going to do something and don't do it, that's trustworthiness. George W. Bush August 30, 2000 From an CNN online chat. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Setting or Getting Relative Path for PHP Includes
I usually use a global variables file included in every page and map my directories that way.. example, have the file you include on each page have these line of code in it: ?php $GLOBALS['images'] = /images/; $GLOBALS['inc''] = /incl/; ? then those directories are mapped, all you have to do is use it this way, I chose images and and include directory for an example to use it for an image img src=?= $GLOBALS['images'] ?whatever.jpg To do includes for a stylesheet or somethin: link href=?= $GLOBALS['inc'] ?style.css type=text/css rel=stylesheet: -phpninja -Original Message- From: Anthony Baker [mailto:[EMAIL PROTECTED] Sent: Monday, December 20, 2004 12:41 PM To: [EMAIL PROTECTED] Subject: [PHP] Setting or Getting Relative Path for PHP Includes Hey Folks, Hoping someone can aid me with a newbie-ish question. I often use PHP includes in my files to pull in assets, but I hard code the relative path to the root html directory for the sites that I'm working on in each file. Example below: ?php $path = '/home/virtual/sitename.com/var/www/html/'; //relative path to the root directory $inc_path = $path . 'code/inc/'; //path and folder the code includes folder is located $copy_path = $path . 'copy/'; //path and folder the copy is located ? I'd like to be able to set the relative path as a global variable from an external file so that I can modify one line of code to change the relative path across the site. This will allow me for easier coding in staging and development environments. What's the best way to do so? Can anyone provide a code example? Either that, or is there a way to call this variable from the server itself so that it's automatically -- and correctly -- set? Thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting or Getting Relative Path for PHP Includes
As already suggested there are $_SERVER variables that can assist you here. Although if you plan on having an include file that will be included by every script in your site you could also use the __FILE__ constant. In your case the following would work: // main.inc.php, located in /home/virtual/sitename.com/var/www/html/ $path = dirname(__FILE__) . '/'; // now all relative includes with $path prefix should correctly resolve // to absolute pathnames -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting or Getting Relative Path for PHP Includes
Can use a directive on your .htaccess: php_value include_path /your/include/path/here This can also be set on your httd.conf in a virtual server basis. If you have access to php.ini is better to set the include there. Regards, Jordi. On Mon, 20 Dec 2004 12:41:06 -0800, Anthony Baker [EMAIL PROTECTED] wrote: Hey Folks, Hoping someone can aid me with a newbie-ish question. I often use PHP includes in my files to pull in assets, but I hard code the relative path to the root html directory for the sites that I'm working on in each file. Example below: ?php $path = '/home/virtual/sitename.com/var/www/html/'; //relative path to the root directory $inc_path = $path . 'code/inc/'; //path and folder the code includes folder is located $copy_path = $path . 'copy/'; //path and folder the copy is located ? I'd like to be able to set the relative path as a global variable from an external file so that I can modify one line of code to change the relative path across the site. This will allow me for easier coding in staging and development environments. What's the best way to do so? Can anyone provide a code example? Either that, or is there a way to call this variable from the server itself so that it's automatically -- and correctly -- set? Thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] includes and classes
Hi I was wondering about includes and classes. I have a class in which depending on a member variable, i should load the proper include, which is really the proper config file for that moment. Now if i do this in the constructor i can't seem to be able to use the variables found in my config in the other member functions. Any way to set a include 'congig.php' as global for the whole class once instead of calling include 'congig.php' it in every function? Thanks for the help, Olivier Dubreuil Président dubreuilmedia www.dubreuilmedia.com 514 457 6211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] includes
Hello all, I have a problem. My directory list is similar to this: root tmpl inc forums test_forum messages test_forum1 .messages My question is in the test_form and message forums. How do I do the include files to read from the tmpl and inc?? I can get the include files to work as long as they are in the root (include tmpl/header.htm). I hope I explained it right. :) ~WILL~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] includes
I think you can do this: ../tmpl/header.htm try it and let us know!! hope this helps Angelo -Original Message- From: Will [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 4:48 PM To: [EMAIL PROTECTED] Subject: [PHP] includes Hello all, I have a problem. My directory list is similar to this: root tmpl inc forums test_forum messages test_forum1 .messages My question is in the test_form and message forums. How do I do the include files to read from the tmpl and inc?? I can get the include files to work as long as they are in the root (include tmpl/header.htm). I hope I explained it right. :) ~WILL~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] includes
If I think I understand you, your 'root' directory is the 'forums' directory, and you'll probably want to do something like: include($_SERVER[DOCUMENT_ROOT] . /../inc/include1.php); The double-dots take you back a directory. Is that what you're after?! Richard -Original Message- From: Will [mailto:[EMAIL PROTECTED] Sent: 05 April 2004 15:48 To: [EMAIL PROTECTED] Subject: [PHP] includes Hello all, I have a problem. My directory list is similar to this: root tmpl inc forums test_forum messages test_forum1 .messages My question is in the test_form and message forums. How do I do the include files to read from the tmpl and inc?? I can get the include files to work as long as they are in the root (include tmpl/header.htm). I hope I explained it right. :) ~WILL~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes
At 16:47 5-4-04, you wrote: Hello all, I have a problem. My directory list is similar to this: root tmpl inc forums test_forum messages test_forum1 .messages My question is in the test_form and message forums. How do I do the include files to read from the tmpl and inc?? It is vital to understand that relative paths in the include command always are relative to the file as opened in the browser. Therefore if you open index.php, which includes inc/somefile.php, and somefile.php includes anotherfile.php, you may expect it looks in the inc directory but in reality it looks in the root directory, because it looks relative to index.php. I can get the include files to work as long as they are in the root (include tmpl/header.htm). I hope I explained it right. :) ~WILL~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes
I had some similar problems ! Here's what I did. include $_SERVER['DOCUMENT_ROOT'] . '/includes/_myInclude.php' ; Putting the DOCUMENT_ROOT ensured I was always pointing to the top directory of the web pages. Daniel Clark I have a problem. My directory list is similar to this: root tmpl inc forums test_forum messages test_forum1 .messages My question is in the test_form and message forums. How do I do the include files to read from the tmpl and inc?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes
Monday, April 5, 2004, 4:47:52 PM, you wrote: Hello all, I have a problem. My directory list is similar to this: root tmpl inc forums snipped My question is in the test_form and message forums. How do I do the include files to read from the tmpl and inc?? I can get the include files to work as long as they are in the root (include tmpl/header.htm). snipped Check the online manual: http://www.php.net/manual/en/function.dirname.php and read the comments (bottom first and up ..) good info there on that very subject. Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines
On 15 January 2004 22:39, Luke wrote: ? Holy cow, this gets simpler all the time. Pretty soon, there'll be ? nothing left on my page but PHP includes and echo functions! ? ? Does this cut down on a website's file size? In other words, are the php ? includes effectively inactive when no one's viewing your main pages, ? leaving them empty of the included pages? Well in a way yes, it wont cut down the transfer bandwitdth, but because you are reusing the same files over again, this will take up less disk space on your server. But the same amount of data is transferred when a user views the page (as you can see from view-source) ? But suppose there's a certain page where I don't want the style sheet in ? the middle - the one I named MIDDLE. Is there a way to mark it in the ? include page, then instruct the main page to either not import it or ? replace it with nothing ()? youd have to use a variable, so in the main page do the following if($pagetoshow == 'withoutmiddle'){ $includemiddle = FALSE; }else{ $includemiddle = TRUE; //(or false depending) } Euch! Very long-winded and inefficient. Much better is: $includemiddle = $pagetoshow!='withoutmiddle'; and in the include do this: if($includemiddle == TRUE){ Likewise -- this can be written more efficiently and more readbly as simply: if ($includemiddle) (Since $includemiddle will be TRUE or FALSE, you can use it directly in the if () -- retrieving its value and comparing it against TRUE gives TRUE if $includemiddle is, er, TRUE, and FALSE if it's FALSE, so doing the comparison just wastes CPU time to reproduce the value you first thought of.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP Includes and Echoes (Sorry; read this post firs t!)
On 16 January 2004 00:30, Freedomware wrote: I should have played with this some more before I posted more questions. After fixing an error on the included page, I replaced every instance of na/a1 on both pages with a1. That seemed to fix everything; the first style sheet comes through, but the second one is blocked - and I don't see any error messages. I have a couple more questions, though. First, how do I turn this exclude function off on a page where I do NOT want to ban style sheet na/a1? I tried deleting the following on the main page: if($pagetoshow == 'withouta1'){ $includea1 = FALSE; }else{ $includeaa1 = TRUE; //(or false depending) } Then I changed TRUE and FALSE in various combinations, but it didn't work. Simple -- if you have a page where you want a1 to be unconditionally included, set the variable to TRUE unconditionally: $includea1 = TRUE; Similarly, if you want it to be unconditionally blocked: $includea1 = FALSE; The include file will test the value of $includea1 as before, and include it or not as you've specified. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Includes and Echoes (From the top...)
Thanks for all the tips. It's getting generally getting clearer, but I'm a little confused somewhere. Can I give you a better explanation of what I'm trying to do, along with my latest code? The pages on this site focus on various nations and states, with lots of links like this: [LOCAL] ../world/na/us/wy/index.php (World/North America/United States/Wyoming) [REMOTE] www.politix.org/world/na/us/wy/ Each page will feature several prominent instances of the name of a country or state, which I can facilitate by using 'MyName', such as the title (MyName = Canada, or Wyoming), along with several instances of its abbreviation, which is used in several URLs and in the top banner; for example, this is the top banner for Alaska: img src=../images/banners/ak.gif width=200 height=150 alt= / Below is the entire head section from the main page. Notice that it's mostly a series of variable statements ('MyName', 'MyCountry', etc.), followed by an included page (head), which is essentially the REAL head section. I inserted one of the functions you suggested - $includea1 = TRUE; - after the include, but I'm sure I did it wrong. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php $myname = 'MyName'; $mynickname = 'MyNickname'; $mycontinent = 'North America'; $mycountry = 'United States'; $mystate = 'MyState'; $postcode = 'wy'; $linkcontinent = '/na'; $linkcountry = '/us'; $linkstate = '/wy'; $periods = '../../../../'; $linkwebring = '/world/na/us/wy/'; include (../../../../includes/head.php); $includea1 = TRUE; ? /head * * * * * * * * * * And here's the included page: ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $statename . '/title'; echo 'meta name=description content=' . $statename . ' versus Microsoft /'; echo 'meta name=keywords content=' . $statename . ' versus Microsoft /'; echo 'meta name=mssmarttagspreventparsing content=true /'; echo 'meta http-equiv=content-Type content=text/html; charset=iso-8859-1 /'; echo 'meta name=author content=David Blomstrom /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'script src=' . $periods . 'js/ss.js type=text/javascript/script'; echo 'script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script'; echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if ($includea1) echo 'link href=' . $periods . 'css' . $linkcontinent . '/a1.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/na/north.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /' ? Note that two of my style sheets are named css/a1.css and css/na/a1.css (na is short for North America). Maybe I should rename the second a1 to avoid confusion, though I'd prefer to tackle it head on and learn how to deal with this situation. (Does $includea1 = TRUE; refer to css/a1.css or css/na/a1.css?) So here's what I have at present: * * * * * * * * * * The first line denotes style sheet css/a1.css, preceded by . $periods ., which can be replaced by ../../ or ../../../, depending on the folder level: echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; * * * * * * * * * * The second line denotes style sheet css/na/a1.css, preceded by if ($includea1), which I'm probably using incorrectly: if ($includea1) echo 'link href=' . $periods . 'css' . $linkcontinent . '/a1.css rel=stylesheet type=text/css /'; Note, also, that I inserted . $linkcontinent ., which will be replaced by na/ (North America) on this particular main page. In summary, it looks like I need to fix two things: MAIN PAGE $linkwebring = '/world/na/us/wy/'; include (../../../../includes/head.php); $includea1 = TRUE; ? /head INCLUDED PAGE echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if ($includea1) echo 'link href=' . $periods . 'css' . $linkcontinent . '/a1.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/na/north.css rel=stylesheet type=text/css /'; * * * * * * * * * * I hope that isn't too confusing. It's actually becoming a lot clearer for me; I'm just temporarily confused. Thanks! * * * * * * * * * * I wrote, ? Holy cow, this gets simpler all the time. ? But suppose there's a certain page where I don't want the style sheet in ? the middle - the one I named MIDDLE. Is there a way to mark it in the ? include page, then instruct the main page to either not import it or ? replace it with nothing ()? On 15 January 2004 22:39, Luke wrote:
RE: [PHP] Re: PHP Includes and Echoes (From the top...)
On 16 January 2004 13:54, Freedomware wrote: Thanks for all the tips. It's getting generally getting clearer, but I'm a little confused somewhere. [SNIP] I inserted one of the functions you suggested - $includea1 = TRUE; - after the include, but I'm sure I did it wrong. Just like before -- put it *before* the include, otherwise the included file won't see it. [SNIP] //-- /script'; echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if ($includea1) echo 'link href=' . $periods . 'css' . $linkcontinent . '/a1.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/na/north.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /' Note that two of my style sheets are named css/a1.css and css/na/a1.css (na is short for North America). Maybe I should rename the second a1 to avoid confusion, though I'd prefer to tackle it head on and learn how to deal with this situation. (Does $includea1 = TRUE; refer to css/a1.css or css/na/a1.css?) Well, which one is controlled by the if ($includea1) test? So here's what I have at present: Apart from the above points, looks ok for what you're trying to do. Keep plugging away and you'll get there -- a couple of years ago I was a complete PHP beginner (although an experienced programmer), and now I have several thousand lines of code in production use! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can you recommend a good PHP includes tutorial?
Freedomware mailto:[EMAIL PROTECTED] on Wednesday, January 14, 2004 5:17 AM said: Wow, that is a lot simpler than I imagined. Thanks for the tip! Imagined? What did the book tell you to do? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable PHP Includes - Is there such a thing?
On 14 Jan 2004 at 21:16, Freedomware wrote: Suppose you design a standard banner for the top of your web pages and use an include to insert it into every page on your site, like this: ?php include (../../../../includes/header.php); ? But you later decide you'd like to change just one element on each page. For example, you might design a standard image banner, followed by a title and subtitle for each page, but you want to change the title to Alaska, Nebraska or Wyoming on each page. Is there a way to do this with PHP? If it has a name, I can search for information online, but I don't even know what to call it. I've played with something of this nature in Dreamweaver. You can design a template that turns out carbon copies of a page, but single out certain items by enclosing them with @@, which are somehow changed on individual pages, or something like that. I can't remember what it's called at the moment. Another strategy would be to use a PHP include to insert an element on different pages, then modify each element with a unique style sheet on each page. But I just wondered if PHP offers additional possibilities for similar experiments. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi A possible option could be something like this {calling_template.php} ?php /*State name does not have to be set statically, can be set from SQL query etc*/ $statename = 'Alaska'; include('/path/header.inc'); ? {header.inc} ?php echo Welcome to the great state of .$statename.now go home! ? That way you can put whatever you want as the statenameat the top of your pages, and the header willalways reflect it. You could also do something similar with objects e.g. ?php include('header.inc'); this_page_head = new header('Alaska') ? if you are that way inclined. Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] There are 10 kinds of people in this world, those who understand binary and those who don't (Unknown) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable PHP Includes - Is there such a thing?
(Oops - I replied by e-mail; guess I should have posted my response to the list.) --- Rory McKinley [EMAIL PROTECTED] wrote: A possible option could be something like this {calling_template.php} ?php /*State name does not have to be set statically, can be set from SQL query etc*/ I think I understand what you're saying. I'm just getting started with PHP and haven't touched MySQL yet, but I can see you're setting up a database, or query, and... That way you can put whatever you want as the statenameat the top of your pages, and the header willalways reflect it. Then you'd put some sort of code in the head section of each page that would draw on the system you set up to translate the codes for each page. I probably didn't work it right, but I think I get the general idea. I'll hang on to the code you gave me and play with it just as quick as I can learn more about this stuff. One question, is the example you gave me a pure PHP function, or does it indeed involve MySQL, too? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable PHP Includes - Is there such a thing?
On 14 Jan 2004 at 23:16, David Blomstrom wrote: --- Rory McKinley [EMAIL PROTECTED] wrote: A possible option could be something like this {calling_template.php} ?php /*State name does not have to be set statically, can be set from SQL query etc*/ I think I understand what you're saying. I'm just getting started with PHP and haven't touched MySQL yet, but I can see you're setting up a database, or query, and... That way you can put whatever you want as the statenameat the top of your pages, and the header willalways reflect it. Then you'd put some sort of code in the head section of each page that would draw on the system you set up to translate the codes for each page. I probably didn't work it right, but I think I get the general idea. I'll hang on to the code you gave me and play with it just as quick as I can learn more about this stuff. One question, is the example you gave me a pure PHP function, or does it indeed involve MySQL, too? Thanks! __ Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus Hi David You do not need to use a query - if you had a database you could retrieve the state names from there and perhaps save on typing. The code that I gave you does not use a MySQL query at all, although I perhaps could have explained it better. Basically, the situation is like this : If you have two scripts - the main page and the header include file and you include the header script in the main page script, there are no issues of variable scope i.e. all variables within the included script are visible to the including script and vice versa. Therefore if you tell the header script to echo a variable and this variable is defined in the main page script instead of the header script, the header script will have access to this variable. From your part, all you have to be willing to do is set the variable on each main page. I hope this has clarified matters somewhat and not made things worse. Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] There are 10 kinds of people in this world, those who understand binary and those who don't (Unknown) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable PHP Includes - Is there such a thing?
Rory McKinley wrote: I hope this has clarified matters somewhat and not made things worse. Absolutely; the only thing that has made matters worse so far is the book Teach Yourself PHP, MySQL and Apache, which had me thinking making PHP includes was going to be a minor wrestling match. In fact, they were so simple even I can understand them, and the information you just gave me is more or less the vision I had in my mind some time ago, before I even heard of PHP. Thanks for the tips! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable PHP Includes - Is there such a thing?
On 15 Jan 2004 at 0:21, Freedomware wrote: Rory McKinley wrote: I hope this has clarified matters somewhat and not made things worse. Absolutely; the only thing that has made matters worse so far is the book Teach Yourself PHP, MySQL and Apache, which had me thinking making PHP includes was going to be a minor wrestling match. In fact, they were so simple even I can understand them, and the information you just gave me is more or less the vision I had in my mind some time ago, before I even heard of PHP. Thanks for the tips! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Glad to have helped. I taught myself from a book called PHP and MySQL Web Development by Welling Thompson (I got it about 18 months ago) I found it quite understandable andthey probably have a new version out by now - perhaps that book will serve you better! Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] There are 10 kinds of people in this world, those who understand binary and those who don't (Unknown) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Includes versus sloppy Dreamweaver code and split elements
Freedomware wrote: My first question is really trivial, but I noticed that Dreamweaver likes to display my PHP includes code like this... ?php include (../../../../includes/state/themes.php); ? When I do a search and replace function, it often jumps onto another element's line, like this: /table ?php include (../../../../includes/state/themes.php); ? I changed the code to this: ?php include (../../../../includes/state/themes.php); ? and it seems to work just fine. But I just wondered if there's some potential problem or convention that I should be aware of. No, white space is ignored in both html and php. * * * * * * * * * * I also wondered if it's OK to include just a portion of another element, like a table or layer, in a PHP include, like this: body div id=main table tr tdFirst Row/td /tr ?php include (../../../../includes/bottom.php); ? /body (The include would include the remainder of the table and div main's closing tag, /div) Again, I tried it, and it seems to work just fine. I just wondered if there's something I should be warned about. Sure you can, but I would not open a tag in one file, and close the tag in another. This makes code very unreadable, the errors are hard to find and also the code is not reusable. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Includes and Echoes in Head Sections and Search Engines
I'm having a blast with PHP includes and echo functions; I never dreamed they could be so simple and effective. But I have a couple questions relating to head sections and search engines. Consider the following html code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php include (../../../../includes/state/head.php); ? meta name=mssmarttagspreventparsing content=true / ?php include (../../../../includes/javascript.php); ? ?php include (../../../../includes/stylesheets.php); ? ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; ? /head body Welcome to ?php echo $statename ?! * * * * * * * * * * And here's the html code from the include named head.php: ?php $todayDate = date(m-d-Y); ? titleFreedomware gt; ?php echo $statename ?/title meta name=description content=?php echo $statename ? versus Microsoft / meta name=keywords content=Alaska, Microsoft, Microshaft, Linux, Bill Gates, corporate corruption / * * * * * * * * * * I discovered that includes will apparently work just about anywhere, but echo functions apparently don't work with the title tag and meta tags; at least, I can't see the word Alaska in those locations when I click View Source in my browser. So I wondered if there IS a way to make echo functions work in meta tags. Also, do you know if text derived from includes causes any problems with search engines? My guess is no, because I can see the included words just fine when I click View Source. Along similar lines, I wondered if there might be potential pitfalls if you import links to style sheets and javascripts as includes. Everything seems to work just fine so far. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Includes and Echoes in Head Sections and Search Engines
From: Freedomware [EMAIL PROTECTED] I discovered that includes will apparently work just about anywhere, but echo functions apparently don't work with the title tag and meta tags; at least, I can't see the word Alaska in those locations when I click View Source in my browser. Look back over your code and you'll realize you set $statename _AFTER_ you include your file. So when the include file is run, $statename doesn't have a value. :) Also, do you know if text derived from includes causes any problems with search engines? My guess is no, because I can see the included words just fine when I click View Source. No, they won't. Search engines, just like browsers, only see the RESULT of your PHP code. So as long as the result is properly formatted HTML and META tags, you're fine. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Includes and Echoes in Head Sections and Search Engines
You are defining the vars after the header/title has already been processed, put it before the head.php, and it should work -Original Message- From: Freedomware [mailto:[EMAIL PROTECTED] Sent: Thursday, January 15, 2004 3:54 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP Includes and Echoes in Head Sections and Search Engines I'm having a blast with PHP includes and echo functions; I never dreamed they could be so simple and effective. But I have a couple questions relating to head sections and search engines. Consider the following html code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php include (../../../../includes/state/head.php); ? meta name=mssmarttagspreventparsing content=true / ?php include (../../../../includes/javascript.php); ? ?php include (../../../../includes/stylesheets.php); ? ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; ? /head body Welcome to ?php echo $statename ?! * * * * * * * * * * And here's the html code from the include named head.php: ?php $todayDate = date(m-d-Y); ? titleFreedomware gt; ?php echo $statename ?/title meta name=description content=?php echo $statename ? versus Microsoft / meta name=keywords content=Alaska, Microsoft, Microshaft, Linux, Bill Gates, corporate corruption / * * * * * * * * * * I discovered that includes will apparently work just about anywhere, but echo functions apparently don't work with the title tag and meta tags; at least, I can't see the word Alaska in those locations when I click View Source in my browser. So I wondered if there IS a way to make echo functions work in meta tags. Also, do you know if text derived from includes causes any problems with search engines? My guess is no, because I can see the included words just fine when I click View Source. Along similar lines, I wondered if there might be potential pitfalls if you import links to style sheets and javascripts as includes. Everything seems to work just fine so far. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines
hi Very simple problems, good to see ur getting the hang of it :) the first is, you have defined your variables after you include the page, so that the echo is outputting a blank variable... so instead of: ?php include (../../../../includes/state/head.php); ? meta name=mssmarttagspreventparsing content=true / ?php include (../../../../includes/javascript.php); ? ?php include (../../../../includes/stylesheets.php); ? ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; ? make it ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; php include (../../../../includes/state/head.php); echo 'meta name=mssmarttagspreventparsing content=true /'; include (../../../../includes/javascript.php); include (../../../../includes/stylesheets.php); \? i just changed the opening and closing tags a little (you didnt need so many) but the main change is, now the variables come before the included file, so that the include file can access those variables too. echo's will work anywhere inside a ?php tag so, it will always output something to the screen no problems with search engines, if you use the meta tags and stuff u usually use, itll work fine javascript, stylesheets and stuff... the only thing to remember is all the stylesheet files, and javascript files are relative to the final page location, not to the include file location, but other than that its the same as normal hope that clears it up a bit :) -- Luke Freedomware [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm having a blast with PHP includes and echo functions; I never dreamed they could be so simple and effective. But I have a couple questions relating to head sections and search engines. Consider the following html code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php include (../../../../includes/state/head.php); ? meta name=mssmarttagspreventparsing content=true / ?php include (../../../../includes/javascript.php); ? ?php include (../../../../includes/stylesheets.php); ? ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; ? /head body Welcome to ?php echo $statename ?! * * * * * * * * * * And here's the html code from the include named head.php: ?php $todayDate = date(m-d-Y); ? titleFreedomware gt; ?php echo $statename ?/title meta name=description content=?php echo $statename ? versus Microsoft / meta name=keywords content=Alaska, Microsoft, Microshaft, Linux, Bill Gates, corporate corruption / * * * * * * * * * * I discovered that includes will apparently work just about anywhere, but echo functions apparently don't work with the title tag and meta tags; at least, I can't see the word Alaska in those locations when I click View Source in my browser. So I wondered if there IS a way to make echo functions work in meta tags. Also, do you know if text derived from includes causes any problems with search engines? My guess is no, because I can see the included words just fine when I click View Source. Along similar lines, I wondered if there might be potential pitfalls if you import links to style sheets and javascripts as includes. Everything seems to work just fine so far. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines
i just changed the opening and closing tags a little (you didnt need so many) but the main change is, now the variables come before the included file, so that the include file can access those variables too. Holy cow, this gets simpler all the time. Pretty soon, there'll be nothing left on my page but PHP includes and echo functions! Does this cut down on a website's file size? In other words, are the php includes effectively inactive when no one's viewing your main pages, leaving them empty of the included pages? Here's another question. I'm replacing the ../ URL prefixes with the echo name $periods, so I can use these includes in pages on several levels, such as geobop/one and geobop/one/two, simply replacing $periods with ../../ or ../../../. Below is some code from my include page: link href=?php echo $periods ?css/a1.css rel=stylesheet type=text/css / link href=?php echo $periods ?css/MIDDLE.css rel=stylesheet type=text/css / link href=?php echo $periods ?css/na/rockies.css rel=stylesheet type=text/css / But suppose there's a certain page where I don't want the style sheet in the middle - the one I named MIDDLE. Is there a way to mark it in the include page, then instruct the main page to either not import it or replace it with nothing ()? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines
? Holy cow, this gets simpler all the time. Pretty soon, there'll be ? nothing left on my page but PHP includes and echo functions! ? ? Does this cut down on a website's file size? In other words, are the php ? includes effectively inactive when no one's viewing your main pages, ? leaving them empty of the included pages? Well in a way yes, it wont cut down the transfer bandwitdth, but because you are reusing the same files over again, this will take up less disk space on your server. But the same amount of data is transferred when a user views the page (as you can see from view-source) ? But suppose there's a certain page where I don't want the style sheet in ? the middle - the one I named MIDDLE. Is there a way to mark it in the ? include page, then instruct the main page to either not import it or ? replace it with nothing ()? youd have to use a variable, so in the main page do the following if($pagetoshow == 'withoutmiddle'){ $includemiddle = FALSE; }else{ $includemiddle = TRUE; //(or false depending) } and in the include do this: if($includemiddle == TRUE){ echo 'link href=' . $periods . 'css/MIDDLE.css rel=stylesheet type=text/css /'; } just a side point, you may be better of doing your html code with echos, as you have a few variables in there.. eg ?php echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if($includemiddle == TRUE){ echo 'link href=' . $periods . 'css/MIDDLE.css rel=stylesheet type=text/css /'; } echo 'link href=' . $periods . 'css/na/rockies.css rel=stylesheet type=text/css /'; ? and if you are echoing a variable, quotes around it arent needed you can just use echo $variable; instead of echo $variable; Luke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines
I wrote: ? But suppose there's a certain page where I don't want the style sheet in ? the middle - the one I named MIDDLE. Is there a way to mark it in the ? include page, then instruct the main page to either not import it or ? replace it with nothing ()? Luke wrote: youd have to use a variable, so in the main page do the following if($pagetoshow == 'withoutmiddle'){ $includemiddle = FALSE; }else{ $includemiddle = TRUE; //(or false depending) } and in the include do this: if($includemiddle == TRUE){ echo 'link href=' . $periods . 'css/MIDDLE.css rel=stylesheet type=text/css /'; } I think I just about have it. But I replaced the middle in both our examples with the page I'm REALLY trying to exclude - na/a1. Most pages on my site will have the following two style sheets: link href=../../../../css/a1.css rel=stylesheet type=text/css / link href=../../../../css/na/a1.css rel=stylesheet type=text/css / But some will only have the first one: link href=../../../../css/a1.css rel=stylesheet type=text/css / So I applied your example to the head section of my main page and came up with this: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; $periods = '../../../../'; include (../../../../includes/state/head.php); if($pagetoshow == 'withoutna/a1'){ $includena/a1 = FALSE; }else{ $includeana/a1 = TRUE; //(or false depending) } ? * * * * * * * * * * And below is all the code from the included page, head.php: ?php $todayDate = date(m-d-Y); if($includeana/a1 == TRUE){ echo 'link href=' . $periods . 'css/na/a1.css rel=stylesheet type=text/css /'; } echo 'titleFreedomware gt; $statename/title'; echo 'meta name=description content=ZXZX versus Microsoft /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/na/a1.css rel=stylesheet type=text/css /'; if($includena/a1 == TRUE){ echo 'link href=' . $periods . 'css/na/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $periods . 'css/na/rockies.css rel=stylesheet type=text/css /'; ? I haven't been able to exclude na/a1 yet, but everything in the included page was working right up until about the end, when I did something that knocked it out of action. Also, I got a division by zero error. Is that something that's caused by a mistake I made in writing code? I read a couple articles online that suggested it's a problem with Apache. Finally, is there a way to validate php, similar to validating pages for html and css? and if you are echoing a variable, quotes around it arent needed you can just use echo $variable; instead of echo $variable; I got a little confused; did I do it right in the example above? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes in Head Sections and Search Engines
Oops, I spotted some big errors in my included page already. Here's the new page: ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; $statename/title'; echo 'meta name=description content=ZXZX versus Microsoft /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if($includena/a1 == TRUE){ echo 'link href=' . $periods . 'css/na/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $periods . 'css/na/rockies.css rel=stylesheet type=text/css /'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes (Sorry; read this post first!)
I should have played with this some more before I posted more questions. After fixing an error on the included page, I replaced every instance of na/a1 on both pages with a1. That seemed to fix everything; the first style sheet comes through, but the second one is blocked - and I don't see any error messages. I have a couple more questions, though. First, how do I turn this exclude function off on a page where I do NOT want to ban style sheet na/a1? I tried deleting the following on the main page: if($pagetoshow == 'withouta1'){ $includea1 = FALSE; }else{ $includeaa1 = TRUE; //(or false depending) } Then I changed TRUE and FALSE in various combinations, but it didn't work. Next, what am I doing wrong with $statename, in the example below? I tried quotes (), single quotes ('') and no quotes at all. ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; $statename/title'; echo 'meta name=description content=ZXZX versus Microsoft /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; BELOW IS THE FINAL VERSION: ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; $statename/title'; echo 'meta name=description content=ZXZX versus Microsoft /'; echo 'script src=' . $periods . 'js/swapclass.js !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php $statename = 'Alaska'; $postcode = 'ak'; $linkcode = 'world/na/us/ak'; $periods = '../../../../'; include (../../../../includes/state/head.php); if($pagetoshow == 'withouta1'){ $includea1 = FALSE; }else{ $includeaa1 = TRUE; //(or false depending) } ? /head INCLUDED PAGE ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; $statename/title'; echo 'meta name=description content=ZXZX versus Microsoft /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/na/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $periods . 'css/na/rockies.css rel=stylesheet type=text/css /'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Includes and Echoes (Sorry; read this post first!)
Sheez, I spotted my error regarding $statename. I changed it to the following, and it fixed that problem. ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $statename . '/title'; echo 'meta name=description content=ZXZX versus Microsoft /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'link href=' . $periods . 'css/a1.css rel=stylesheet type=text/css /'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/na/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $periods . 'css/na/rockies.css rel=stylesheet type=text/css /'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can you recommend a good PHP includes tutorial?
I thought this would be the easiest thing to learn, but I'm striking out right and left. I bought a book about PHP, but the includes examples don't work for me at all. I searched several forums and www.php.net, but it's hard to even zero in on a good tutorial. I think part of the problem is that the word include apparently covers a lot of territory. I'm looking for a plain vanilla equivalent to Microsoft's include pages. For example, suppose I want to have the same title and image at the top of every page on my website. I could put the title and image on a separate page, then use an include to insert it on all the other pages. It might be especially nice to find an online working example that could be downloaded and picked apart. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can you recommend a good PHP includes tutorial?
[snip] I thought this would be the easiest thing to learn, but I'm striking out right and left. I bought a book about PHP, but the includes examples don't work for me at all. I searched several forums and www.php.net, but it's hard to even zero in on a good tutorial. [/snip] http://www.php.net/include There is no tutorial for this because it is painfully simple to use. Create toBeIncluded.php -- ?php $todayDate = date(m-d-Y); ? h1Today is ?php echo $todayDate; ?/h1 You're all done! Now create myIncluded.php -- html head/head body h1Welcome!/h1 ?php inlclude(toBeIncluded.php); ? /body /html All done! Now just place these files in the same directory in your web server and load myIncluded.php from the browser. You may have to pay close attention to the paths of the files, but it is pretty simple really. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can you recommend a good PHP includes tutorial?
Yikes, scratch my last post! I think I stumbled over the answer just after I posted it. Freedomware wrote: I thought this would be the easiest thing to learn, but I'm striking out right and left. I bought a book about PHP, but the includes examples don't work for me at all. I searched several forums and www.php.net, but it's hard to even zero in on a good tutorial. I think part of the problem is that the word include apparently covers a lot of territory. I'm looking for a plain vanilla equivalent to Microsoft's include pages. For example, suppose I want to have the same title and image at the top of every page on my website. I could put the title and image on a separate page, then use an include to insert it on all the other pages. It might be especially nice to find an online working example that could be downloaded and picked apart. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can you recommend a good PHP includes tutorial?
Wow, that is a lot simpler than I imagined. Thanks for the tip! Jay Blanchard wrote: [snip] I thought this would be the easiest thing to learn, but I'm striking out right and left. I bought a book about PHP, but the includes examples don't work for me at all. I searched several forums and www.php.net, but it's hard to even zero in on a good tutorial. [/snip] http://www.php.net/include There is no tutorial for this because it is painfully simple to use. Create toBeIncluded.php -- ?php $todayDate = date(m-d-Y); ? h1Today is ?php echo $todayDate; ?/h1 You're all done! Now create myIncluded.php -- html head/head body h1Welcome!/h1 ?php inlclude(toBeIncluded.php); ? /body /html All done! Now just place these files in the same directory in your web server and load myIncluded.php from the browser. You may have to pay close attention to the paths of the files, but it is pretty simple really. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can you recommend a good PHP includes tutorial?
And, you can even do this automatically using the auto_prepend_file and auto_append_file settings: http://us3.php.net/manual/en/configuration.directives.php These can be set in your Apache config file, php.ini or .htaccess, so you can control what files are used down to the lowest subdirectory level. Of course, if you need to include() in the middle of a page, or conditionally include files, these won't work - steve At 5:16 AM -0800 1/14/04, Freedomware wrote: Wow, that is a lot simpler than I imagined. Thanks for the tip! Jay Blanchard wrote: [snip] I thought this would be the easiest thing to learn, but I'm striking out right and left. I bought a book about PHP, but the includes examples don't work for me at all. I searched several forums and www.php.net, but it's hard to even zero in on a good tutorial. [/snip] http://www.php.net/include There is no tutorial for this because it is painfully simple to use. Create toBeIncluded.php -- ?php $todayDate = date(m-d-Y); ? h1Today is ?php echo $todayDate; ?/h1 You're all done! Now create myIncluded.php -- html head/head body h1Welcome!/h1 ?php inlclude(toBeIncluded.php); ? /body /html All done! Now just place these files in the same directory in your web server and load myIncluded.php from the browser. You may have to pay close attention to the paths of the files, but it is pretty simple really. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- ++ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | ++ | [EMAIL PROTECTED]: 1001 Work units on 23 oct 2002 | | 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens... | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable PHP Includes - Is there such a thing?
Suppose you design a standard banner for the top of your web pages and use an include to insert it into every page on your site, like this: ?php include (../../../../includes/header.php); ? But you later decide you'd like to change just one element on each page. For example, you might design a standard image banner, followed by a title and subtitle for each page, but you want to change the title to Alaska, Nebraska or Wyoming on each page. Is there a way to do this with PHP? If it has a name, I can search for information online, but I don't even know what to call it. I've played with something of this nature in Dreamweaver. You can design a template that turns out carbon copies of a page, but single out certain items by enclosing them with @@, which are somehow changed on individual pages, or something like that. I can't remember what it's called at the moment. Another strategy would be to use a PHP include to insert an element on different pages, then modify each element with a unique style sheet on each page. But I just wondered if PHP offers additional possibilities for similar experiments. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't Access PHP Includes Above Current Directory if using SSL
I hope all have had a great holiday season! My configuration is: RH Linux Kernel 2.4.20-8, Apache 2.0.48, OpenSSL -0.9.6l, PHP 4.3.4, Apache was compiled with SSL and SSL appears to work OK. My document root is http - /www/sd/htdocs, https - /www/sd/htdocs/jobs I don't want anyone accessing the jobs directory so I have a redirect in httpd.conf to send requests for http://www/sd/htdocs/jobs to https://www/sd/htdocs/jobs instead. All seems to work fine with http and https access with one blaring exception. My PHP scripts have include directives which pull include files from /www/sd/htdocs/include and that all works fine if run from one of the http subdirectories i.e. When running /www/sd/htdocs/test/index.php with this line: ?php include(../include/prepend.php); ? All works fine (note running from http area). But if I try the above code from an https directory, say https://www/sd/hddocs/jobs the it will fail with: PHP Warning: main(../include/prepend.php): failed to open stream: No such file or directory in /www/sd/htdocs/jobs/index.php on line 4 There is no problem if I change the include location to /www/sd/htdocs/jobs/include, I can run the scripts fine. So it seems I can include at the same level or below but not up any level in the directory tree if using https. I've also tried SSI to include a file (for testing purposes) with a similar result: !--#include file=../include/middle.html -- unable to include file ../include/middle.html in parsed file /www/sdfair.com/htdocs/jobs/index.shtml Fails as you can see from the https side but works fine if run from http://www/sd/htdocs/test (an area where SSL is not enabled). This is the case with all other parts of the web site without SSL, all scripts with include directives work fine. I've searched the web and SSL documentation but I seem to be missing something here and am just banging my head against a wall. I've modified both httpd.conf and ssl.conf 'til I'm blue with no change in function. Has anyone with PHP run into similar problems? I imagine this is some SSL configuration oversight on my part but so far I've been unable to find it and would ask for anyone who may be able to help to please give suggestions on what directive(s) are causing this. I'd really appreciate a point in the right direction on a resolution. Thanks for your help, .. Steve
[PHP] Includes inside includes
I've written a class that is calling an include function to include a setup file. The problem is that the setup file is in another directory than the class. I'm including the file using: include (../common/setup.inc); Is there a way that i can make the relative path inside the class definition specific to the class definition, not the page that is including the class definition. I have trouble when I include the class definition. I get an error that it cannot include ../common/setup.ini whenever the class is called from a directory above common. I hope this makes sense. and thanks for your help. Robbert van Andel __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Includes inside includes
To call the file from anywhere within the document space, try this: include($_SERVER[DOCUMENT_ROOT]./common/setup.inc); Jim - Original Message - From: Robbert van Andel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, December 21, 2003 1:41 AM Subject: [PHP] Includes inside includes | I've written a class that is calling an include | function to include a setup file. The problem is that | the setup file is in another directory than the class. | I'm including the file using: | | include (../common/setup.inc); | | Is there a way that i can make the relative path | inside the class definition specific to the class | definition, not the page that is including the class | definition. I have trouble when I include the class | definition. I get an error that it cannot include | ../common/setup.ini whenever the class is called | from a directory above common. | | I hope this makes sense. and thanks for your help. | | Robbert van Andel | | | __ | Do you Yahoo!? | New Yahoo! Photos - easier uploading and sharing. | http://photos.yahoo.com/ | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, visit: http://www.php.net/unsub.php | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] includes...
bit of a random thought I need answering really... when referencing external files, what's the difference between: ../ / ./ I know that ../ means back one directory and jsut a / means look from the root directory, but what is: ./ ??? Cheers all.. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] includes...
That means the current directory Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists [EMAIL PROTECTED] wrote: bit of a random thought I need answering really... when referencing external files, what's the difference between: ../ / ./ I know that ../ means back one directory and jsut a / means look from the root directory, but what is: ./ ??? Cheers all.. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes...
[EMAIL PROTECTED] wrote: bit of a random thought I need answering really... when referencing external files, what's the difference between: ../ / ./ I know that ../ means back one directory and jsut a / means look from the root directory, but what is: ./ ??? ./ means the current directory. Best Bao Cheers all.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] includes...
Oh... So it's the same as not having any /'s just the file name? Marco Tabini [EMAIL PROTECTED] 18/12/2003 14:01 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP] includes... That means the current directory Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists [EMAIL PROTECTED] wrote: bit of a random thought I need answering really... when referencing external files, what's the difference between: ../ / ./ I know that ../ means back one directory and jsut a / means look from the root directory, but what is: ./ ??? Cheers all.. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] includes...
[EMAIL PROTECTED] wrote: Oh... So it's the same as not having any /'s just the file name? Not quite. For example, when you have more than one executables with the same name, when you use ./executable_name, it will call the the one in your current directory, otherwise it will use the one in your path. Best Bao Marco Tabini [EMAIL PROTECTED] 18/12/2003 14:01 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP] includes... That means the current directory Cheers, Marco -- php|architect - The Magazine for PHP Professionals Try us free at http://www.phparch.com! Complete searchable PHP mailing list archives at http://www.phparch.com/mailinglists [EMAIL PROTECTED] wrote: bit of a random thought I need answering really... when referencing external files, what's the difference between: ../ / ./ I know that ../ means back one directory and jsut a / means look from the root directory, but what is: ./ ??? Cheers all.. * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php