codebloo

PODS CMS 2.0 Including templates in PHP pages

Mar 12th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. http://www.openscriptsolution.com/cms/wordpress/pods-2-0-how-to-display-pods-item-using-pods-page-and-pods-template/
  2. <?php
  3.  
  4. // Get 3 records per page, ordered by name ascending,
  5. $params = array( 'orderby' => 'name ASC', 'limit' => 3 );
  6.  
  7. // Maps to the new find method
  8. $pod_countries = pods( 'countries', $params );
  9.  
  10. // Display it to the template
  11. echo $pod_countries->find( $params )->template( 'country_list' );
  12.  
  13. // Display the pagination
  14. echo $pod_countries->pagination();
  15.  
  16. ?>
  17.  
  18. <?php
  19.  
  20. // Get the latest variable from Pods URL
  21. $id = pods_url_variable('last');
  22.  
  23. // Define the params to find the Pods Item based on the $id
  24. $params = array( 'where' => 'permalink = "'.$id.'"' );
  25.  
  26. // Display it by using Pods Template
  27. echo pods( 'countries' )->find( $params )->template( 'country_detail' );
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment