Feel I’m flooding the forum today…

I’m playing around with Symphony for a page of my own and it will incoporate a few external datasources. One of these is Tumblr.

So I have a URL like{$tumblr-type}/{$tumblr-id} where $tumblr-type is the entry type on Tumblr. I need to pass this URL param to my DS which fetches the entries of that type from Tumblr.

However, the type names are in English (text, photo, quote etc…) and I’d like to have my URL structure in Swedish since the page content will be in Swedish.

Therefore I’d like a URL like to pass me all the quote entries from Tumblr (“citat” means “quote”). This makes it (to my knowledge) impossible to send the URL param (since it’s in Swedish) in the dynamic DS URL to fetch the correct result (since the Tumblr API wants “type=quote”).

Is there in any way I could say “if URL param $tumblr-type-sv is ‘citat’ then set $tumblr-type-en to ‘quote’” and use the $tumblr-type-en to get the right data from Tumblr?

Any other possible solutions are appreciated, can’t be the first one to have this problem?

(Another solution would ofcourse be to have different pages and data sources for each Tumblr type, but it feels clumsy.)

@czheng: Oh I don’t know how I could’ve missed that one!

So I solved the issue thanks to the Global Parameter Loader. It aint a pretty solution but it works;

With the GPL I create seven new parameters, one for each Tumblr type. Each of these evaluates the URL param $tumblr-type-sv (the Swedish name of the Tumblr type I use in my URL):

$tumblr-type-quote = return ($context['params']['tumblr-type-sv'] == 'citat') ? "quote" : "";

That gives me one param with content and six empty params. In the data source I set the Dynamic XML URL as:{$tumblr-type-text:$tumblr-type-link:$tumblr-type-quote:$tumblr-type-photo:$tumblr-type-chat:$tumblr-type-video:$tumblr-type-audio}

Which will only return the none empty $tumblr-type-* to the DS.

But since I’m a client side kinda guy and haven’t programmed PHP for years, someone must be able to help me write a short PHP snippet that could evaluate the $tumblr-type-sv back to the English type in one param $tumblr-type-en instead of the way I’m doing it right now.


No suggestions on your current approach. But an idea for another one: Instead of accessing the data from Tumbler, import it to Symphony’s database. Nick Dunn has posted a tutorial on this. Not on Tumbler specific, but I think it should be easy to adapt. Don’t have a link to it at hand, but google for ‘archiving xml symphony’.

It would give two benefits: Solving your problem and make sure your Tumbler entries are available even if Tumbler should be unaccessible for any reason.

The idea has crossed my mind, however, I see one problem with it which is probably very solvable; if I update a post on Tumblr when it’s already saved to Symphony I need a way to update this post in Symphony.

But I might try this out and still use Tumblr as a first choise and if it fails retriving data from Tumblr, the site should fall back to use it’s own database.

I have no experience with Tumbler, but perhaps there is a possibility to compare timestamps between the remote and the local entries?

@thoresson: Sure, that’s my intention, each post grabbed from Tumblr contains timestamps in three formats (don’t ask me why, feels a bit redundant); GMT, local time and unix timestamp. (See for example.)

I will definitely try this, but first I’ll try something simpler, like storing data from my Delicious account, just to revamp my PHP skills and try the technique.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details