To get parent_id of a child-page ?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
Trangsene
Forum Members
Forum Members
Posts: 19
Joined: Thu Aug 28, 2008 9:43 am

To get parent_id of a child-page ?

Post by Trangsene »

Hello I try do do a simple thing, to get the parent_id of a child-page.
I've installed CGSimpleSmarty which permits me to get the parent's alias. So it's quite what I needed.

But I was wandering, is there a quick smarty syntax to get the parent_id of a child-page ???
Something like (not working) :

Code: Select all

global $gCms;
$thispage = "";
$thispage = $gCms->variables['parent_id'];
echo "<p>Parent ID : ".$thispage."</p>";
Or I have to go through an SQL request using the content_id of the child-page in order to get the parent_id ?
User avatar
Augustas
Forum Members
Forum Members
Posts: 241
Joined: Wed Oct 17, 2007 6:09 pm
Location: the world

Re: To get parent_id of a child-page ?

Post by Augustas »

I think there is no such quick way to do it.
Use cgsimplesmarty to get Parent Alias, and once you have it - make simple SQL query to the Content table to get the ID of the page whose Alias you already know.
http://FollowTheRoad.com/ - living on the road...
http://www.kligys.com/ - asmeninis blog'as...
Post Reply

Return to “Developers Discussion”