Today I started using Pods CMS plugin in this website. After visitting the official website of Pods CMS, I think this plugin indeed the best one if you want to add the customize page to your WordPress website that contains of the certain data that derived from database without having use Post or Page feature in WordPress website. I have been trying and testing this plugin, until I made a modification in order user can change the maximum record number per page on the Filter form.
- Open your \pods\core\list_filters.php file, and find this code:
44 45 46 47 48 49
// Display the search box and submit button $search = empty($_GET['search']) ? '' : $_GET['search']; ?> <input type="text" class="pod_search" name="search" value="<?php echo $search; ?>" /> <input type="submit" class="pod_submit" value="<?php echo $label; ?>" /> </form>replace with this following code:
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
// Display the search box and submit button $search = empty($_GET['search']) ? '' : $_GET['search']; $pagelimit = empty($_GET['limit']) ? '10' : $_GET['limit']; ?> <input type="text" class="pod_search" name="search" value="<?php echo $search; ?>" /> Limit: <select name='limit'> <?php for ($x = 5; $x <= 50; $x += 5) { ?> <option value="<?=$x?>" <?=($pagelimit==$x )?'selected':''?>><?=$x?></option> <?php } ?> </select> <input type="submit" class="pod_submit" value="<?php echo $label; ?>" /> </form> -
Adjust your PodPages, for exampe:
Before adding pagelimit as dynamic param, here is your PodPages:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php get_header(); $Record = new Pod('state'); echo "<h2>States List</h2>"; echo $Record->getFilters(); echo "<br />"; // Pagelimit as a static param belongs to findRecords() function $Record->findRecords('name ASC', 10); $total_rows = $Record->getTotalRows(); echo "Total Record = <b>".$total_rows."</b><br />"; echo $Record->getPagination(); echo "<br />"; echo "<table border='1' width='100%' cellpadding='2'>"; echo "<tr><td align='right' width='10%'><b>Rec#</b></td><td><b>Name</b></td></tr>"; echo $Record->showTemplate('state_list'); echo "</table>"; get_footer(); ?>
After adding this modification, now the pagelimit has become a dynamic parameter, thus visitor can change the maximum record per page on the Form filter. Please compare the PagePod below with the one above:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php get_header(); $Record = new Pod('state'); echo "<h2>States List</h2>"; echo $Record->getFilters(); echo "<br />"; // Now pagelimit as a dynamic parameter on the form $pagelimit = empty($_GET['limit']) ? '10' : $_GET['limit']; $Record->findRecords('name ASC', $pagelimit); $total_rows = $Record->getTotalRows(); echo "Total Record = <b>".$total_rows."</b><br />"; echo $Record->getPagination(); echo "<br />"; echo "<table border='1' width='100%' cellpadding='2'>"; echo "<tr><td align='right' width='10%'><b>Rec#</b></td><td><b>Name</b></td></tr>"; echo $Record->showTemplate('state_list'); echo "</table>"; get_footer(); ?>
Demo:
- http://www.openscriptsolution.com/data/states/
- http://www.openscriptsolution.com/data/countries/
Have a nice code!

Recent Comments