Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
(Abandoned) Add extra fields to the comment form
I’ve embarked on a weekend project to learn the basics of KML with a view to having Textpattern output KML to populate an embedded Google Map, all because I’m curious as to where you guys all live. Should this get any traction, it might also be useful for arranging local meet ups on the grounds that there might be a critical mass of Textpattern users in a given area who want to meet/eat/drink/date/etc.
I have a single article (id=1) with comments open and unmoderated. I’m using comment_name
to populate the KML name
, comment_message
to populate the KML description
within each Point
and I’m kludging comment_email
to be latitude & longitude points. I’m then using asv_recent_comments
to loop through the article comments.
The problem I have is that the Google Local supplied latitude & longitude co-ordinates don’t play nice when imported back into Google Local via KML — they’re back-to-front. In this example, 50.732164,-4.617455 is my office co-ordinates according to Google Local (north Cornwall, UK). Outputting this string in KML per the schema, the location then becomes -4.617455,50.732164 — near the Seychelles.
Without resorting to a form submission that requires to manually enter latitude/longitude details (I’m busy and lazy), one solution I thought of was to add an additional field or two to the comment form, a la custom fields in articles. Is that possible via a plugin?
Thank you in advance for any assistance or directions.
Here’s my page:
<txp:mg_setheader name="Content-Type" value="application/vnd.google-earth.kml+xml" /><kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Textpattern Users Maps</name>
<open>1</open>
<description>A quick-and-dirty Pragmatika weekend project.</description>
<txp:asv_recent_comments id="1" form="kml-placemark" limit="9999" />
</Document>
</kml>
Here’s my comment form:
<Placemark>
<name><txp:comment_name link="0" /></name>
<description><txp:comment_message /></description>
<Point>
<coordinates><txp:comment_email />,10</coordinates>
</Point>
</Placemark>
Here’s the output from my KML (validates, source is here if you’re interested):
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Textpattern Users Maps</name>
<open>1</open>
<description>A quick-and-dirty Pragmatika weekend project.</description>
<Placemark>
<name>Donald Swain</name>
<description>I enjoy your site very much.</description>
<Point>
<coordinates>50.732164,-4.617455,10</coordinates>
</Point>
</Placemark>
</Document>
</kml>
Last edited by gaekwad (2012-10-29 13:09:49)
Offline
Re: (Abandoned) Add extra fields to the comment form
OK, I’m abandoning this project for now. I tried. I failed. It’ll be revisited as a weekend project some time in the future.
Offline