Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-08-26 21:12:51

dubsky
Archived Plugin Author
From: France
Registered: 2004-08-26
Posts: 3

[archived] eoi_location: latitude, longitude

Notice: This thread is archived, this plugin is no longer available.

**********************************************************

Hi,

This is my first day toying with Textpattern. I only noticed today that it’s been released under the terms of the free GPL license (much respect Dean!) and thought I’d give it a wirl. For starters, I thought I’d port a plugin I made for some other blogware to TXP.

blub, blub, blub… (sound of me going down the deep end)

Here’s what I’m trying to do: Make a plugin for TXP so people can enter a latitude and longitude (into a custom field) for any post and have a heap of cool geo-location features on their site like links to MapQuest, GeoURL tags, and a list of other articles ordered by geographic proximity to the current one.

Here’s where I’m stuck: I can’t find the source code to any of the TXP plugins which I think might help me learn how to access custom fields and the database. Hints anyone?


EOIN DUBSKY
“I know when Bush is lying. His lips move.” – John Pilger, journalist and film-maker.

Offline

#2 2004-08-26 23:58:51

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

Re: [archived] eoi_location: latitude, longitude

here’s some code that might help you with custom fields.

<pre> if (is_array($atts)) extract($atts); global $thisarticle; global $txpac;

//Get extra fields from db $id = $thisarticle[“thisid”]; $query = safe_rows(“*”, “textpattern”,“id=’$id’”);

//Shove values + labels into simple arrays for($i = 1;$i <= 10;$i++) { $name = “custom_”.$i.”_set”; $fields[$i][“label”] = $txpac[$name]; $vname = “custom_”.$i; $fields[$i][“value”] = $query0[$vname]; }
</pre>

eventually it’ll be a plugin in itself, but when I get the time.

Last edited by tmacwrig (2004-08-27 00:00:00)

Offline

#3 2004-08-27 00:00:42

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

Re: [archived] eoi_location: latitude, longitude

(uh, dean… footnotes are happenin inside of < pre > tags…)

Offline

#4 2004-08-27 07:21:59

dubsky
Archived Plugin Author
From: France
Registered: 2004-08-26
Posts: 3

Re: [archived] eoi_location: latitude, longitude

Thanks tmacwrig!

I take it that the bit which didn’t make it through textile properly above was supposed to be square brackets open, zero, square brackets close.

But I can’t get it to work. Indeed… I can’t even get my plugin to return a simple “hello world” string (simply using an echo command). :-(

I’m finding this compiling business for plugins a real drag. Anyone got the source code to a simple plugin which I can learn from? :-)


EOIN DUBSKY
“I know when Bush is lying. His lips move.” – John Pilger, journalist and film-maker.

Offline

#5 2004-08-27 07:36:44

sderuiter
Plugin Author
From: Laren NH
Registered: 2004-02-24
Posts: 38
Website

Re: [archived] eoi_location: latitude, longitude

Have you already installed a plugin? If so, go to the code (admin/plugins) and add the following:
function sdr_echo ($atts) {
return echo “Hello World!”;
}

Now add the <txp:sdr_echo /> tag to a page. This should output the string at your chosen loation.

Last edited by sderuiter (2004-08-27 07:39:15)

Offline

#6 2004-08-27 15:19:56

dubsky
Archived Plugin Author
From: France
Registered: 2004-08-26
Posts: 3

Re: [archived] eoi_location: latitude, longitude

http://eoin.free.fr/media/eoi_location.txt

Plugin name: eoi_location

Version: 0.1b

Adds geographic location features to Textpattern, as found in WordPress, and a similar plugin I did for NucleusCMS. Name one of your custom fields ‘latitude, longitude’ and you can enter a geographic location for any article using decimal notation (e.g. “xx.xxxx, yy.yyyy”). Then add the tag txp:eoi_location with any of the attributes below to have some fun.

  • Attributes:
  • customid – Enter the number of the custom field you are using for geographic coordinates (default is 1).
  • format – Enter any of these formats to have your coordinates come that way (like format=raw):
    • raw – Exactly as it appears in the custom field (default).
    • lat – Latitude as it appears in the custom field.
    • lon – Longitude as it appears in the custom field.
    • multimap – URL to use in a hyperlink to multimap.com.
    • mapquest – URL to use in a hyperlink to mapquest.com.
    • acmemap – URL to use in a hyperlink to acme.com’s mapper program (US only).

Example:
txp:eoi_location customid=“3” format=“multimap” could be used inside an “a href” HTML tag like this: a href=“txp:eoi_location customid=“3” format=“multimap” “Show in MultiMap/a

To do…
I want to add distance calculation, proximity searching, and other features like that. I also want allow input and output in DMS format too.

Last edited by dubsky (2004-08-27 15:32:30)


EOIN DUBSKY
“I know when Bush is lying. His lips move.” – John Pilger, journalist and film-maker.

Offline

Board footer

Powered by FluxBB