Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-02-03 10:03:50

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

Safari Sun

Just launched a new Textpattern site for my client Safari Sun, who create tailor-made safari holidays to Africa and the Indian Ocean Islands.

The site is fully responsive and uses the following plugins:

  • adi_contact
  • adi_menu
  • adi_variables
  • bot_write_tab_customize
  • rah_expanding
  • rah_function
  • rah_repeat
  • rah_sitemap
  • upm_textile
  • zem_contact_reborn
  • zem_nth

I also used ied_plugin_composer to help build a custom plugin to use openexchangerates.org to update the exchange rates. Currently this is a one-click manual process in the Textpattern admin interface, but I’m planning on creating a custom URL to trigger the update, which I can then call using a cron job.

Offline

#2 2014-02-03 17:25:39

etc
Developer
Registered: 2010-11-11
Posts: 5,218
Website GitHub

Re: Safari Sun

Nice addition to your (and txp) portfolio! I like the responsiveness and (relative) js-independence, add a noscript static google map, and it will be perfect.

springworks wrote #278629:

I also used ied_plugin_composer to help build a custom plugin to use openexchangerates.org to update the exchange rates. Currently this is a one-click manual process in the Textpattern admin interface, but I’m planning on creating a custom URL to trigger the update, which I can then call using a cron job.

Why wouldn’t you include openexchangerates.org json data in aks_cache and retrieve it from there (with your plugin) on demand, so site visitors would trigger the rates update?

Offline

#3 2014-02-03 17:42:52

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

Re: Safari Sun

etc wrote #278641:

Nice addition to your (and txp) portfolio! I like the responsiveness and (relative) js-independence, add a noscript static google map, and it will be perfect.

Why wouldn’t you include openexchangerates.org json data in aks_cache and retrieve it from there (with your plugin) on demand, so site visitors would trigger the rates update?

Thanks. I always like to minimise dependence on js if I can – I’ll look into putting in a noscript static fallback.

There’s one or two more things to add to the site still, but I wanted to launch it ASAP because the site it replaced looked so outdated and was awful for SEO.

I’ll take a look at aks_cache too and try and work out how to use it with openexchangerates.org and see if that is an easier way to have the exchange rates auto update. In reality, rates don’t need to be updated more than once a day or once a week as they are only used to give visitors an indication of a currency’s value.

Offline

#4 2014-02-03 21:49:19

etc
Developer
Registered: 2010-11-11
Posts: 5,218
Website GitHub

Re: Safari Sun

springworks wrote #278642:

I’ll take a look at aks_cache too and try and work out how to use it with openexchangerates.org and see if that is an easier way to have the exchange rates auto update.

That’s fairly easy, the first visitor (probably a bot) will trigger the rates update and store them for 24 hours:

<txp:variable name="exrates">
	<txp:aks_cache id="exrates" noreset="1" hour="24">
		<txp:etc_query url="http://openexchangerates.org/api/latest.json?app_id=your_app_id" markup="raw" />
	</txp:aks_cache>
</txp:variable>

<h4>Currency</h4>
<txp:etc_query data='<txp:variable name="exrates" />' query="." markup="json" wraptag="p">
	Kenyan Shilling (KES), £1 = {$/({rates/KES?}|{rates/GBP?}).number_format($|2)} KES<br />
	<small><em>Last updated: {$strftime(%d %B %Y|{timestamp?})}</em></small>
</txp:etc_query>

You can replace etc_query with your own plugin, of course.

Offline

#5 2014-02-03 22:39:30

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

Re: Safari Sun

Ahh, that’s interesting.

At the moment, I’m storing the exchange rate data in articles in a separate section, so the only time I’m only calling openexchangerates.org is when the update button on the Admin side is clicked.

That way, page loads aren’t held up by waiting for openexchangerates.org data to be processed. But, of course, by caching the JSON response using aks_cache, with your system that is only happening once per day (or whatever the caching frequency is).

Offline

#6 2014-02-04 06:17:02

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 595
Website

Re: Safari Sun

I liked it, thanks for sharing. Now I feel like going to Madagascar in August to see lemurs. Anyway, really great job.

Offline

Board footer

Powered by FluxBB