I’ve been very silent on Facebook, Twitter, and this blog lately. That because I can’t constantly access Twitter anymore from work, they blocked me… so no more useful stuff to tweet and brag about excepted one thing: Pods CMS. Pods CMS is a WordPress plugin that pretty much turn your blog into a CMS. You can build a Wiki, Glossary, Recipes, Hotel listing etc… the possibilities are endless. Although, you will need to know at least some PHP to make this thing tuned to the way you want it to be. I have been playing with it in the past 2 weeks, I have to say I am very impress of how this plugin works. So I did a test on one of my hobbies: Kendo. I’ve always wanted to collect data on Kendo Dojo, how many practitioners, and Kendo tournament results in the U.S. I was able to create this very complex database that it can be listed by Federations, State, Country, Dojo, and down to the individual Kendo-ist data. The awesome thing is? Each listing can be linked to one another. For example, if you viewing by Federations, you can list all the Dojo in that federation, and with links to each Dojo AND the state. You can add BUILT-IN filters and search on top! The backend is all done for you, all you have to do is to make things pretty. Ain’t that grant?
The problem of this awesome plugin that it is quite new, the documentations, tutorials, and resources are quite limited. But the developers are extremely helpful on their own forum – so you’ll have to do a lot of digging to find the answers you need… in which I did. I also found the tutorials were kind of half way done, they stopped at displaying the data, but not showing how to write simple Display Helper and Input Helper. So I’m going to jog that down here.
If you have not gone through the documentations and have some basic data to play with, you should get going (thinking putting one simple guide of how to put all the pods together later).
Disclaimer:
The following helpers are very basic ones that I found myself used them a lot and repeatedly, so hopefully these will be useful for someone else also. On a side note that I am NOT a hardcore PHP coder, I understood enough basic PHP codes to customize them. If you know a better way, feel free.
So let’s get rolling…
Software Note: Pods CMS 1.7.3 / WP 2.8.4
Documentation: http://pods.uproot.us/codex/helpers
Display Helpers: Display Helpers are the codes that help to display your results in a nicer, customized look. For example, say that you want to show all of your ingredients in a recipe, by default, they’ll be list as such: “Ingredient 1Ingredient 2″ – it is hard to read. So you can write a Display Helper to show them as “Ingredient 1, Ingredient 2″. Got it?
By default, the Display Helper passes $value as an array for you to manipulate as such: $value[0][’column_name’].
Adding a Display Helper
Adding a new Display Helper is very simple, see below:
List Single Result ONLY (No Link)
Add a new Display Helper and name this one something like “print_r”:
1 | <?php print_r($value[0]['name']); ?> |
<?php print_r($value[0]['name']); ?>
I have these two generic Display Helpers displaying a single result only. By default, if you having something like {@column_name}, it will show column’s name and it is linked to a its own detailed page (if it is bi-directional), something like (http://domain.com/your_pod/column_name/1). Where the very last part is actually the row ID. So what if you want to display your data with a custom permalink/slug? Such as: (http://domain.com/your_pod/slug_name) This helper will come in handy in your Pod Templates page:
1 | <a href="/pod_name/{@slug}">{@column_name,print_r}</a> |
<a href="/pod_name/{@slug}">{@column_name,print_r}</a>You probably noticed that I put the helpers right next to the Magic Tags instead of adding the Display Helpers like this:
It’s a matter of personal preference really. If you want, you can add the helper inside the admin interface. If you’d rather add the Display Helper through the admin interface, you don’t need to add “print_r” inside {@print_r}.
Displaying Arrays
The following will display “Ingredient 1, Ingredient 2, Ingredient 3″ instead of “Ingredient 1Ingredient 2Ingredient 3″ with links or no link to your liking:
".$val['name']."";
}
echo implode(', ', $output);
} else {
echo "No record found";
}
?>
If you just want to display the results without the links, simply remove the “href” on line 8.
Note: This helper will only link to current pod, what I mean: “/pod1/slugname”, but not able to link “/pod2/slugname”. The reason is that this script will only grab the pod’s name which is “/pod1″ and add itself to the “a href…”. If you want to link to a different pod, you’ll just have to add a new helper with a minor change of instead of ‘$pod’ (line 8 ) where the “a href…” is to your actual pod’s name, make sense?
Well, that’s it for now… next up, :inputHelper:.

