CMS Made Simple Forums
https://forum.cmsmadesimple.org/

A UDT that gets the current page ID (CMSMS 2)
https://forum.cmsmadesimple.org/viewtopic.php?f=4&t=76505
Page 1 of 1

Author:  Guido [ Wed Apr 26, 2017 12:44 pm ]
Post subject:  A UDT that gets the current page ID (CMSMS 2)

Create a UDT called 'get_current_page_id':

Code:
$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:
{get_current_page_id assign='page_id'}


And you'll have {$page_id} available.

Author:  calguy1000 [ Wed Apr 26, 2017 12:57 pm ]
Post subject:  Re: A UDT that gets the current page ID (CMSMS 2)

{$page_id} is built in.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/