Batfastad Posted May 31, 2004 Posted May 31, 2004 I have a pretty extensive CDML website running at the moment. But increasingly I'm learning PHP and have been converting many of the pages on my main website to php. In php, when you do an include of a php file, any PHP code in that file is parsed. With CDML, if you include a CMDL format file, the CDML isn't parsed. I was looking at using the FX.php solution and will shortly begin testing it. I'd like to know this... Say for example a have a menu file, written in PHP, with the menu items being records from a filemaker database. Say I use fx.PHP to do this. Can I include that menu file in my main site? So effectively I'm including a PHP menu file, with parsed FileMaker data. Does doing this work in the normal way as PHP? Included PHP files get parsed?
Garry Claridge Posted May 31, 2004 Posted May 31, 2004 Have you tried using the include like this: include("http://myaddress:myport/FMPro?-db=mydb.fp5&-format=myformatfile.html&-findany"); It works for me. The CDML is processed. Good Luck. Garry
Batfastad Posted June 1, 2004 Author Posted June 1, 2004 Oh right. I assumed that wouldn't work! BUT IT DOES - YES!!! Does it work if you do a CDML include? So you go [FMP-Include: http://myaddress:myport/FMPro?-db=mydb.fp5&-format=myformatfile.html&-findany] : I'm not at a computer where I can test it at the moment but I'm not expecting that to work. I guess it makes sense that the PHP include above works, as the PHP processor is making a request to the web companion. I've been using SSI for a many years and have only recently started using PHP. Of course using SSI, included files aren't parsed, so all this is a bit of a pleasant surprise to me really. It will enable me to make sites so easy to update, which will be excellent. Using PHP, could I do something like this... Say I have a file - index.php and in it there is an include request for a file menu.php In the file menu.php, is an include to some FileMaker data using say, include("http://myaddress:myport/FMPro?-db=mydb.fp5&-format=myformatfile.html&-findany"); So you're including a PHP file, which pulls in the results from a request to the web companion?? If that does work then that's great. Also means I can seriously cut down on the load the web companion has to do. So it literally just processes a format file with [FMP-Record, and a few other lines. All the rest is done on our hosted webspace in PHP. Good news so far. Thanks for the advice.
Garry Claridge Posted June 1, 2004 Posted June 1, 2004 The [FMP-Include] will work because the CDML processing is done within WebCompanion be fore the page isreturned to the PHP script. I haven't tried a "double" include(), however it should work. Another PHP function I use is file_get_contents(). The FM "Format" file returned is usually a text file with variable pairs; e.g.: myfield1=[FMP-Field:myfield1]&myfield2=[FMP-Field:myfield2]&..... Hope this is of interest. Garry
Guest Posted June 1, 2004 Posted June 1, 2004 Let me understand : You have a filemaker db with data for a menu (example : a db with all the menu items) You have some home page (index.php) and you want to include a builded menu on it from Filemaker. Ex : menu.php -------- ... some code here, refer to FX $request = FMFind() foreach ($request as $table) ... some code, the menu is builded index.php --------- include ("menu.php"); --- It should works, I've already made such solution... :
Recommended Posts
This topic is 7550 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now