Page 1 of 1

A UDT that gets the current page ID (CMSMS 2)

Posted: Wed Apr 26, 2017 12:44 pm
by Guido
Create a UDT called 'get_current_page_id':

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);
Now in your template use:

Code: Select all

{get_current_page_id assign='page_id'}
And you'll have {$page_id} available.

Re: A UDT that gets the current page ID (CMSMS 2)

Posted: Wed Apr 26, 2017 12:57 pm
by calguy1000
{$page_id} is built in.