A UDT that gets the current page ID (CMSMS 2)
Posted: Wed Apr 26, 2017 12:44 pm
Create a UDT called 'get_current_page_id':
Now in your template use:
And you'll have {$page_id} available.
Code: Select all
$assign = isset($params['assign']) ? $params['assign'] : 'page_id';
$hm = cmsms()->GetHierarchyManager();
if ( empty($page_id) ) $page_id = \cms_utils::get_current_pageid();
$smarty->assignGlobal($assign,$page_id);
Code: Select all
{get_current_page_id assign='page_id'}