Name Mon Lu

Love jQuery/CSS

Blog about Webdev

Twitter supawaza

RSS Twitter Flickr

What I am up to:


This is going to be a short post. Magic Tags are very awe­some, but on the Pods CMS doc­u­men­ta­tion failed to men­tion some­thing very sim­ple yet use­ful. Before any­thing, here’s a quick run down of what Magic Tags are…

Soft­ware Note: Pods CMS 1.7.3 / WP 2.8.4

Doc­u­men­ta­tion: http://pods.uproot.us/codex/magic_tags

What are Magic Tags

From Pods CMS’ doc­u­men­ta­tion: Magic Tags are used exclu­sively within Pod tem­plates to dynam­i­cally pull in col­umn values.

Usage: {@column_name} / {@column_name,display_helper}

In addi­tion to the doc­u­men­ta­tion: {@column_name.another_column_name}

The above method allow you access a dif­fer­ent Pod’s columns when it is a PICK col­umn inside a pod.

Let’s say you have to two pods. The Per­son pod, and Coun­try pod. The Per­son pod has a PICK col­umn of the Coun­try pod to iden­tify the nation­al­ity of that per­son, and you want to list all the peo­ple as: Person’s Name, Coun­try (where you want to access by: http://domain.com/person). So inside the Pod Tem­plates you would have some­thing like this to show:

<p>{@name}, {@country}</p>

The above dis­plays some­thing like below on the Per­son list page (http://domain.com/person):

Mon Lu, United States
John Smith, Canada
Ken Yamamoto, Japan

Now you want to get a bit sophis­ti­cated that you want to link the person’s name to its own detail page, and the coun­try is linked to its own page list­ing all the peo­ple from that coun­try or some­thing like that. Not only that, you want to link the page using its own slugs/permalinks like this: http://domain.com/person/mon_lu and http://domain.com/country/usa – assum­ing you have a col­umn named slug in the Per­son pod, and or abbrv in the Coun­try pod. Before I fig­ured this out, I used a Dis­play Helper to grab the abbrv from the Coun­try pod. But the eas­ier way is the fol­low­ing, assum­ing this is still http://domain.com/person list­ing all the peo­ple where the Coun­try pod is a PICK col­umn inside the Per­son pod:

<p><a href="/person/{@slug}">{@name}</a><a href="/country/{@country.abbrv}">{@country}</a></p>

Sim­ple enough, yeah?

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • email
  • Ping.fm
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter

Related Posts

No related posts.

This entry was posted on Saturday, September 26th, 2009 at 7:32 AM and is filed under Pods CMS, Web Dev. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

No Responses to “Pods CMS: Magic Tag”