Can you guys please tell me if it is possible to have multiple pod query on a template?
what i want to do is a page that shows videos uploaded by the members but having at least two sections of content in the page.
Sorts by date and;
Sorts by rating
I know it must be possible if I use the page only option and not pass it into the magic tag, or is it possible with magic tags too?
It’s definitely possible. In the page template you create simply adjust the the ORDER BY parameter for your findRecords(); method. Adjusting this will allow you to order videos how you need them and this can easily be done by creating two instance of the Pods object.
The following code will help you present find video records and sort them by date descending (showing the newest first). If you want to utilize video ratings, then I will need some more information on the Pod field that you’re using to store the rating, so we can hopefully sort by it. This should get you started though!
Also note that in the following example I’m assuming your Pod name is videos.
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$Videos=newPod('videos');
$Videos->findRecords('p.created DESC',-1);
$total_rows=$Videos->getTotalRows();
if(0<$total_rows)
{
while($Videos->fetchRecord())
{
//Do your stuff here, like getting fields, HTML markup, etc.
}
}
else
{
echo'Currently there are no videos. Please check back again.'."n";