Custom Page Weight Field inside CMS how to?

edited January 2014 in News & Announcements
I would like to add a custom weight field for the pages and need to sort the result based on the same field. Please suggest how to achieve this.

Thank you
Anunay

Comments

  • edited 6:54AM
    That sounds like you would need to create a layout with a "weight" field associated with it. Then you would need to create a page assigning the appropriate values to that weight field for each page. To retrieve the pages in a particular order using the weight value you could do an active record query joining the fuel_pages table to the fuel_pagevariables table with a where condition of fuel_pagevariables.name = 'weight' and a join on the page_id. You could try something like the following (warning... I did not test this out):
    $where['fuel_pagevariables.name'] = 'weight'; $CI->fuel_pages->db()->join('fuel_pagevariables', 'fuel_pagevariables.page_id = fuel_pages.id', 'left'); $CI->fuel_pages->db()->group_by('page_id'); $pages = $CI->fuel_pages->find_all($where, 'fuel_pagevariables.name asc');
Sign In or Register to comment.