GetSimple Support Forum

Full Version: Child and Parent pages...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to get the name of a child page and display it on the parent page? I would also like to get the date the child page was created/edited and displayed on the parent page. Anyways of doing this? I've tryed all the functions listed on the getsimple site but they didnt do what I was hoping for.

My page structure:

Code:
Index (parent)
- post-1 (child)
- post-2 (child)
- post-3 (child)

Thanks Smile
you would have to make your own functions. like listed in another thread about showing multiple inputs on one page. for the date...

in your templates functions.php or admin/inc/theme_functions.php
Code:
function get_content($page){  
            $path = "data/pages";
            $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
            $data = simplexml_load_string($thisfile);
            echo stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));;
    }
    
    function get_content_date($page, $i = "l, F jS, Y - g:i A"){
        global $TIMEZONE;
        
        $path = "data/pages";
        $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
        $data = simplexml_load_string($thisfile);
        if ($TIMEZONE != '') {
            if (function_exists('date_default_timezone_set')) {
                date_default_timezone_set($TIMEZONE);
            }
        }
        echo date($i, strtotime($data->date));
    }
Nijikokun Wrote:you would have to make your own functions. like listed in another thread about showing multiple inputs on one page. for the date...

in your templates functions.php or admin/inc/theme_functions.php
Code:
function get_content($page){  
            $path = "data/pages";
            $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
            $data = simplexml_load_string($thisfile);
            echo stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));;
    }
    
    function get_content_date($page, $i = "l, F jS, Y - g:i A"){
        global $TIMEZONE;
        
        $path = "data/pages";
        $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
        $data = simplexml_load_string($thisfile);
        if ($TIMEZONE != '') {
            if (function_exists('date_default_timezone_set')) {
                date_default_timezone_set($TIMEZONE);
            }
        }
        echo date($i, strtotime($data->date));
    }


Hey, thanks for the reply Smile

I've added that to my functions.php file. What command in the template.php am I using to get the date of a child page?

Thanks.
get_content_date('page-name','date format goes here google php date for more info');
hey, it dosen't quite work yet.

The code ive used to inset the date in the template.php file are these:

Code:
<?php get_content_date('post-1','d M Y'); ?>
<?php get_content_date('post-2','d M Y'); ?>
<?php get_content_date('post-1','d M Y'); ?>

The output from this is the same for all three: 01 Jan 1970

Confused not sure whats going on here...
Anyone able to help? :/
I'll check it out in a moment.
Nijikokun Wrote:I'll check it out in a moment.

hey, did you have any luck looking into it? Smile