I am a ColdFusion Developer and I do not know much about PHP. I am now using MODx to run some of my sites but I ran into an issue when trying to include a cfm page into a php page. I already have some dynamic pages built in ColdFusion so I just want to utilize some of the code I already have.
I would like to know if there is a way that I can:
1. Include a page from a different language like .cfm, .jsp, .asp, etc. within PHP and pass the current page’s query parameters to it by a relative path on the same web root? If so, how?
2. Get a page’s content through a url like a PHP http tag? If so, how?
Thanks.
-
☆ A M B ☆
- 24,524 Posts
If it’s in a form use $_POST[’fieldname’] to access them. If it’s from the URL query string, use $_GET[’key’] to access them. $_REQUEST[’name’] will get POST, GET and COOKIE into one array, but that’s a bit less secure since it jumbles them all up together. You should only use $_REQUEST when you aren’t sure where it’s coming from; I’ve only used it with some AJAX libraries that are inconsistent how they pass the values.
Make sure to validate and "sanitize" any and all incoming data, no matter where it comes from (for example, if you use a hidden field in a form to pass on a value via the POST). Especially if you’re going to use the values in email or to query the database. Even if it’s only going to be used as a search filter in the database.
If you’re new to PHP here’s a couple of good articles:
http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
http://www.onlamp.com/pub/a/php/2003/07/31/php_foundations.html
@sottwell
It Worked!!!
Much appreciated...
I am going to start a new thread requesting other good online PHP tutorials so that I can get up to speed with this language that I am beginning to like.
Thanks again.
-
☆ A M B ☆
- 24,524 Posts
Ah, the enthusiasm of youth! Would that I could recover that energy
Just curious, why are you not doing this 100% in CF? Is this a result from the CF community (specially the open source community) being very limited or are you making a conscious decision to move to php?