Jump to content

Export Field Contents to Web page with PHP


This topic is 4738 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I'm trying to write a script to create a webpage file with some php in it. I'm constructing all the code for this webpage in a script in FileMaker which saves to a text field then uses "export field contents" to write the code to a file on my web server. Everything seems to work great, but the php code in the webpage does not seem to work. When I "view source" on the webpage and compare it a php file that I built from scratch, it looks identical except the php does not seem to have compiled in the version of the file that was exported from FileMaker.

The url for this webpage is: http://hs-srv1.sccoe.org/GoogleMapHSNew.php?mylat=37.2606870&mylon=-121.9503290

The php in the code is supposed to pull the latitude and longitude out of the url and process it, but it's not working...

Here is a part of the code from the webpage my FileMaker export:

// Create the map and center it on a default location

var map = new GMap2(document.getElementById("map"));

map.setCenter(new GLatLng(<?php echo $_GET["mylat"]; ?>, <?php echo $_GET["mylon"]; ?>), 12);

For comparison, here is what it should look like when you "view source":

// Create the map and center it on a default location

var map = new GMap2(document.getElementById("map"));

map.setCenter(new GLatLng(37.2606870, -121.9503290), 12);

Does anyone have any ideas? Does it have to do with the UTF encoding that FileMaker uses with the export field contents script step? I've run out of ideas.

Link to comment
Share on other sites

In the FMP export code you don't need php to pull the lat and lon data in. FMP does not understand php. Instead use the FMP field name.

Link to comment
Share on other sites

the php does not seem to have compiled

I am not sure what that means. Is the content of the file exported from Filemaker correct? If yes, then the only question (that pertains to Filemaker) is the question of file encoding. If you suspect it causes a problem (which it very well might), it should be quite easy to test: open the exported file in a text editor, change the encoding to UTF-8 and save. If the new file behaves correctly...

Link to comment
Share on other sites

  • Newbies

I am not sure what that means. Is the content of the file exported from Filemaker correct? If yes, then the only question (that pertains to Filemaker) is the question of file encoding. If you suspect it causes a problem (which it very well might), it should be quite easy to test: open the exported file in a text editor, change the encoding to UTF-8 and save. If the new file behaves correctly...

Thanks, that was it. I opened it in notepad, saved to UTF-8 and now it works. I was hoping to run this script unattended each night from the FM server to re-create my google map with any address changes that occurred during the day. Do you know of any way to automate the conversion of my exported file to UTF-8?

Link to comment
Share on other sites

  • Newbies

The best way, IMHO, would be to export as XML and use a XSLT stylesheet to insert the exported data into the PHP template.

I'd like to learn how to do that. Can you suggest any tutorials or examples I could start with? Thanks.

Link to comment
Share on other sites

I used to direct people to this introduction:

http://my.advisor.com/doc/12009

but it looks like it's gone. There are a few example files installed with the application and a lot more posted here (mostly by Fenton or by me). But XSL in general is not a Filemaker technology, and there is a very large number of resources on the web.

Link to comment
Share on other sites

  • Newbies

I used to direct people to this introduction:

http://my.advisor.com/doc/12009

but it looks like it's gone. There are a few example files installed with the application and a lot more posted here (mostly by Fenton or by me). But XSL in general is not a Filemaker technology, and there is a very large number of resources on the web.

Thanks. I'll do some research.

Link to comment
Share on other sites

This topic is 4738 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.