• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: A UDT that gets the current page ID (CMSMS 2)
PostPosted: Wed Apr 26, 2017 12:44 pm 
Offline
Forum Members
Forum Members

Joined: Sat Aug 29, 2009 3:00 pm
Posts: 221
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.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: A UDT that gets the current page ID (CMSMS 2)
PostPosted: Wed Apr 26, 2017 12:57 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 7803
Location: Fernie British Columbia, Canada
{$page_id} is built in.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting