|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
php equivalent of application cfc
Hi All,Tom King 03/02/07 06:36 A There isn't one.Peter Boughton 03/02/07 07:35 A heheh,Tom King 03/02/07 08:04 A > Not my choice, working on a site where they can't afford to move theRick Root 03/02/07 08:10 A Ah, interesting... Did you see my survey about potential low-cost CFML hosting?Peter Boughton 03/02/07 09:36 A Heh,Tom King 03/02/07 09:41 A Um... WTF would you want twenty-five gigs of space for!? :SPeter Boughton 03/02/07 04:31 P $50(USD) a month will get you pretty good CF hosting at a lot of places...Eric Roberts 03/02/07 07:37 P Uh, $50 a month is £308 a year.Peter Boughton 03/03/07 06:56 A Thanks all - the htacess trickery is worth a punt I feel !Tom King 03/03/07 11:21 A Hey Tom -Rob Wilkerson 03/02/07 08:03 A That sounds like the sort of thing I'm after...Tom King 03/02/07 08:06 A > I.e, I want to be able to do this, without having to put the includesTom Chiverton 03/02/07 08:27 A That could work (as would the related require_once() function), butRob Wilkerson 03/02/07 08:36 A > That could work (as would the related require_once() function), butTom Chiverton 03/02/07 08:54 A Ugh. :-)Rob Wilkerson 03/02/07 09:06 A hehe, so glad I don't have to deal with this on a regular basis -Tom King 03/02/07 09:30 A Ah, I think that was the thing I was referring to with my Apache comment.Peter Boughton 03/02/07 09:35 A Tom,Randy Johnson 03/02/07 08:54 A I just asked two pro level PHP developers I used to work with and they both said there is no automatic way of including a file. Only way is to have an explicit include call.Andy Matthews 03/02/07 10:25 A Don't know what to tell them, but I've done it. At least with PHPRob Wilkerson 03/02/07 10:47 A Yeah, I've done that too. It's something you have to set up in yourChristopher Jordan 03/02/07 10:54 A In fact, here are the two lines I included in my php.ini file (which onChristopher Jordan 03/02/07 10:58 A > In fact, here are the two lines I included in my php.ini file (which onTom Chiverton 03/02/07 11:17 A Probably not, but I didn't read where the original poster said he wasChristopher Jordan 03/02/07 11:47 A You don't need to have access to the php.ini file. You can set thoseRyan Stille 03/02/07 12:20 P Cool. I didn't know that. Theoretically, then, you could have aRob Wilkerson 03/02/07 01:26 P Correct! They wouldn't be very useful if you could only set them forRyan Stille 03/02/07 02:54 P I run a shared PHP Hosting company and the .htaccess with prepend is how IEric Haskins 03/02/07 03:49 P Ask on a PHP list I would say....Robertson-Ravo, Neil (RX) 03/02/07 06:47 A I'd be more than surprised if every page didn't already have an include... if so just piggyback it.Kevin Aebig 03/02/07 10:51 A Most shared hosts disable those entries. In other words, your code is noKevin Aebig 03/02/07 11:07 A All the more reason that CF is better than PHP. ;o)Christopher Jordan 03/02/07 11:16 A It's not about access as you can set those values with php_ini(). It's aboutKevin Aebig 03/02/07 02:43 P Hi All, Sorry for the OT: I'm new to PHP, and am trying to find out if there is the equivalent of application.cfc onrequest() function: I.e, I want to be able to do this, without having to put the includes in every file....: <cffunction name="onrequest"> <cfargument name="targetpage'' required="yes"> <cfinclude template="header.html"> <cfinclude template="#targetpage#> <cfinclude template="footer.html"> </cffunction> Help? Many thanks T There isn't one. You can mimic it with Apache stuff - but why bother when its far better to stick to the glorious CFML and not have to worry about stuff like this. Perhaps you could say why you want to use PHP, so we can convince you that your reasons are worthless and you should stay with us. ;) ----- Excess quoted text cut - see Original Post for more ----- heheh, Not my choice, working on a site where they can't afford to move the hosting... If it was my choice, I'd rewrite the damn thing from scratch in CF T On 2 Mar 2007, at 11:24, Peter Boughton wrote: ----- Excess quoted text cut - see Original Post for more ----- > Not my choice, working on a site where they can't afford to move the > hosting... > If it was my choice, I'd rewrite the damn thing from scratch in CF I did a fair amount of PHP work between 6 and 3 years ago. I usually refuse PHP work now if offered to me. I just don't have the interest in struggling with things that are so simple in Coldfusion. Rick -- > I'm not certified, but I have been told that I'm certifiable... > Visit http://www.opensourcecf.com today! Ah, interesting... Did you see my survey about potential low-cost CFML hosting? </cheeky-plug> :) ----- Excess quoted text cut - see Original Post for more ----- Heh, Can you 60 gigs a month bandwidth, 25 gigs webspace, with CF for less than £200 PA? T On 2 Mar 2007, at 13:26, Peter Boughton wrote: ----- Excess quoted text cut - see Original Post for more ----- Um... WTF would you want twenty-five gigs of space for!? :S It's a possibility. Would probably require going with an unmanaged US-based server (rather than the managed UK-based one I'm currently looking at.) And depend on finding a minimum of ten people wanting a similar package. And it wouldn't be Adobe CF, it'd be Railo (because it's better, faster, and a lot less money.) But yeah, certainly a possibility. :) ----- Excess quoted text cut - see Original Post for more ----- $50(USD) a month will get you pretty good CF hosting at a lot of places... Sunshinetechsolutions.com Hostnexus.com Those are 2 good hosts... Eric Heh, Can you 60 gigs a month bandwidth, 25 gigs webspace, with CF for less than £200 PA? T On 2 Mar 2007, at 13:26, Peter Boughton wrote: ----- Excess quoted text cut - see Original Post for more ----- Uh, $50 a month is £308 a year. The £200 a year Tom asked for is $32 a month. ----- Excess quoted text cut - see Original Post for more ----- Thanks all - the htacess trickery is worth a punt I feel ! T On 3 Mar 2007, at 10:45, Peter Boughton wrote: ----- Excess quoted text cut - see Original Post for more ----- Hey Tom - It's been a couple of years (like 5), but as of PHP 4, there was a setting in php.ini that allowed you to define a file that would be called before every request the way Application.cfm is called. You have to define it explicitly, but it behaves exactly the same way, in my experience. That file can include custom functions. Unfortunately, I can't remember the setting offhand. ----- Excess quoted text cut - see Original Post for more ----- That sounds like the sort of thing I'm after... Will now have to see if I can get to the ini file on shared hosting :( T On 2 Mar 2007, at 13:01, Rob Wilkerson wrote: ----- Excess quoted text cut - see Original Post for more ----- > I.e, I want to be able to do this, without having to put the includes > in every file....: Every PHP app I've looked at has an include_once() at the top of each file :-/ -- Tom Chiverton Helping to augmentatively transition revolutionary segments On: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. That could work (as would the related require_once() function), but it's maintenance-intensive since it has to be explicitly included on every page. Look at the auto_prepend_file directive in php.ini (I looked it up and I think that's what I was referring to in my earlier post). If you need something to emulate OnRequestEnd.cfm, try auto_append_file. Hope this helps. ----- Excess quoted text cut - see Original Post for more ----- > That could work (as would the related require_once() function), but > it's maintenance-intensive since it has to be explicitly included on > every page. OTTOMH: find . -name '*.php' -exec cp {} {}.1;cat header.php {}.1 > {} \; :-) -- Tom Chiverton Helping to simultaneously innovate B2C environments On: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. hehe, so glad I don't have to deal with this on a regular basis - thanks for the tips! T On 2 Mar 2007, at 14:05, Rob Wilkerson wrote: ----- Excess quoted text cut - see Original Post for more ----- Ah, I think that was the thing I was referring to with my Apache comment. Didn't realise it was actually a php.ini thing. ----- Excess quoted text cut - see Original Post for more ----- Tom, Use cfdirectory to read in all the PHP pages, do a cffile="read" on the php page, do a cffile action="write" to put the <?php include_once("config.php");?> at the top, then do a cffile action="append" to put the rest of the PHP script to it. There you go :-) You still get to use CF during the project :-) -Randy ----- Excess quoted text cut - see Original Post for more ----- I just asked two pro level PHP developers I used to work with and they both said there is no automatic way of including a file. Only way is to have an explicit include call. Hi All, Sorry for the OT: I'm new to PHP, and am trying to find out if there is the equivalent of application.cfc onrequest() function: I.e, I want to be able to do this, without having to put the includes in every file....: <cffunction name="onrequest"> <cfargument name="targetpage'' required="yes"> <cfinclude template="header.html"> <cfinclude template="#targetpage#> <cfinclude template="footer.html"> </cffunction> Help? Many thanks T Don't know what to tell them, but I've done it. At least with PHP 4.x. I've included the php.ini doc. Search for "auto_prepend_file". The second hit describes what it does. http://de3.php.net/manual/en/ini.core.php > I just asked two pro level PHP developers I used to work with and they both said there is no automatic way of including a file. Only way is to have an explicit include call. Yeah, I've done that too. It's something you have to set up in your php.ini file. I used it to act like application.cfm (instead of application.cfc).. it worked like a champ. Hopefully, I won't have to work on another PHP project for a long time. Viva la ColdFusion! :o) Cheers, Chris Rob Wilkerson wrote: ----- Excess quoted text cut - see Original Post for more ----- In fact, here are the two lines I included in my php.ini file (which on my fadoracore4 system is located in /etc) ; Automatically add files before or after any PHP document. auto_prepend_file = application.inc.php auto_append_file = onrequestend.inc.php I named the files anything I wanted and I included the .inc to remind me that they were include files. Then I just named them after their coldfusion counterparts. Have fun, and educate your pro level PHP developers. ;o) Cheers, Chris Rob Wilkerson wrote: ----- Excess quoted text cut - see Original Post for more ----- > In fact, here are the two lines I included in my php.ini file (which on > my fadoracore4 system is located in /etc) On a typical shared host, you wouldn't be able to set those parameters though, would you ? -- Tom Chiverton Helping to continually transition principle-centered architectures On: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. Probably not, but I didn't read where the original poster said he was using a shared host. And you're probably right, the shared host probably has these turned off. I was just trying to show that it *is* possible to prepend and append files in php. I'm also used to hosting my own. I'm fortunate enough to work for a small company who is in the business of hosting for our clients. Chris Tom Chiverton wrote: ----- Excess quoted text cut - see Original Post for more ----- -- http://www.cjordan.us You don't need to have access to the php.ini file. You can set those directives in an .htaccess file. I done this on shared hosting providers. If you did it in .htaccess the syntax would be: php_value auto_prepend_file Application.php php_value auto_append_file onRequestEnd.php -Ryan Christopher Jordan wrote: ----- Excess quoted text cut - see Original Post for more ----- Cool. I didn't know that. Theoretically, then, you could have a separate auto_append and auto_prepend file for each web root or even directory within a webroot, right? ----- Excess quoted text cut - see Original Post for more ----- Correct! They wouldn't be very useful if you could only set them for the server as a whole. If you set a prepend/append file in your webroot, and want it turned off in a subdirectory, you can put a .htaccess file in there and set the auto_prepend_file value to "none" (without quotes I believe) and it will turn it off. If you really wanted to emulate the way ColdFusion looks for and executes Application.cfm you could put some code in your auto prepended file that looks for Application.php in the same file as the current script. If its not found, check the parent directory, etc. etc. -Ryan Rob Wilkerson wrote: ----- Excess quoted text cut - see Original Post for more ----- I run a shared PHP Hosting company and the .htaccess with prepend is how I setup phpfusebox sites Eric Ask on a PHP list I would say.... "This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions." Visit our website at http://www.reedexpo.com Hi All, Sorry for the OT: I'm new to PHP, and am trying to find out if there is the equivalent of application.cfc onrequest() function: I.e, I want to be able to do this, without having to put the includes in every file....: <cffunction name="onrequest"> <cfargument name="targetpage'' required="yes"> <cfinclude template="header.html"> <cfinclude template="#targetpage#> <cfinclude template="footer.html"> </cffunction> Help? Many thanks T I'd be more than surprised if every page didn't already have an include... if so just piggyback it. Otherwise, an easy solution to find/replace in a bunch of files is to search for the the <html> tag and replace it with <?php include "blah.php"; ?><html> That way you don't have to worry about headers before any output as well. !k Hi All, Sorry for the OT: I'm new to PHP, and am trying to find out if there is the equivalent of application.cfc onrequest() function: I.e, I want to be able to do this, without having to put the includes in every file....: <cffunction name="onrequest"> <cfargument name="targetpage'' required="yes"> <cfinclude template="header.html"> <cfinclude template="#targetpage#> <cfinclude template="footer.html"> </cffunction> Help? Many thanks T Most shared hosts disable those entries. In other words, your code is no longer easily deployed to another server. His pro level PHP developers will probably agree... =] !k In fact, here are the two lines I included in my php.ini file (which on my fadoracore4 system is located in /etc) ; Automatically add files before or after any PHP document. auto_prepend_file = application.inc.php auto_append_file = onrequestend.inc.php I named the files anything I wanted and I included the .inc to remind me that they were include files. Then I just named them after their coldfusion counterparts. Have fun, and educate your pro level PHP developers. ;o) Cheers, Chris Rob Wilkerson wrote: ----- Excess quoted text cut - see Original Post for more ----- both said there is no automatic way of including a file. Only way is to have an explicit include call. >> > > All the more reason that CF is better than PHP. ;o) I was of course, assuming that you had control over the server. His pro level folks said, "there is no automatic way of including a file." They're just wrong. I didn't say it would be practical, and in a shared environment you may be right. But their **IS** a way to do it. ;o) Cheers mate! Chris Kevin Aebig wrote: ----- Excess quoted text cut - see Original Post for more ----- It's not about access as you can set those values with php_ini(). It's about where or not the shared host blocks it or not. !k You don't need to have access to the php.ini file. You can set those directives in an .htaccess file. I done this on shared hosting providers. If you did it in .htaccess the syntax would be: php_value auto_prepend_file Application.php php_value auto_append_file onRequestEnd.php -Ryan Christopher Jordan wrote: ----- Excess quoted text cut - see Original Post for more ----- though, ----- Excess quoted text cut - see Original Post for more -----
|
March 22, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||