One question before jumping on the pods bandwagon

0

I am new to pods and I have no experience with php programming. But after studying the videos and users manual I feel I should be able to build my own pod. There is one thing that I cannot figure out yet. Any help is highly appreciated.

I want to use a Pod to display a list of standards that are related to a directive. I would like to have a podpage for every directive (displaying a list standards that relate to the directive). It would be even cooler if I could have a dropdown selector to select the directive and that will lead to displaying the related list.

I figure I need two pods:

standards: - name (text) - slug (slug) - title (text) - related_directive (pick, bi-directional)

directives: - name (text) - slug (slug) - title (text) - description (desc) - related_standards (pick, bi-directional

I guess I also need a template for the standard list and for the standard details, as well as a template for the directive list and the directive details.

I learned that I need to set up pod pages: - /standards - /standards/* - /directives - /directives/*

What I cannot figure out is what php code or short codes I need to add to which template or page to display only a list of standard related to a certain directive.

I hope that anyone can help, so I will definitely jump on the pod bandwagon.

asked Jul 12 '10 at 10:03

hazu

1

add comment
enter at least 15 characters

4 Answers

0

You should play around with the software and do a few test-installs. follow all the Monday by Noon Guides carefully and I have a good feeling that in a few hours you'll have answered all your own questions.

answered Jul 13 '10 at 12:45

wesbos

56

add comment
enter at least 15 characters
0

Thank you for your prompt reply, Wesbos.

Yes, I have studied the Monday by Noon Guides, as well as the videos I have found on YouTube. Great stuff and very helpful indeed.

I have started playing around with Pods, and I got everything set up without problems.

The only problem I could not solve maybe due to my limited php coding experience. Or simply because I am overlooking simple solutions.

What I could not figure out using all guides is how I can display only the records that meet certain conditions. I want to show from a pod only those records for which a pick filed is set to a certain value. To be more concrete using the example above: I want to show a list from the standards pod, but only those entries that have the related_directive set to a certain value in the name field.

Do I need to use $Record->findRecords(); for that? Can I make a selector that generates a list on the basis of the selection?

Thank you.

answered Jul 13 '10 at 8:54

hazu

1

add comment
enter at least 15 characters
0

Yeah, you need to use the WHERE syntax in findRecords()

here is a snippet from a findRecords() where I only want to pull pods with an id of 1

 $setting->findRecords('id ASC','','t.id = 1' );

answered Jul 13 '10 at 1:22

wesbos

56

add comment
enter at least 15 characters
0

Just as said above, you can use WHERE to filter your results. What should be mentioned - while you are on pod page for a single item, you don't need to filter those results because you'll already have only one Pod item. The first thing you'll need on your /* pages is pods_ url_ variable to get information about which standrad/directive was selected. Then you can use it to filter out Pod item with the same slug.

<?php
$slug = pods_url_variable('last');
$pod = new Pod (' *your pod name here* ', $slug); // you don't need to use findRecords here at all
$name = $pod->get_field('name');
$title = $pod->get_field('title');
$related_names = $pod->get_field(' *your second pod name here* .name'); //you can change "name" for other column machine names, of course
?>

answered Jul 13 '10 at 7:33

Fike

208

edited Jul 13 '10 at 7:33

add comment
enter at least 15 characters