Posts: 14
Threads: 5
Joined: Jan 2010
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
Posts: 111
Threads: 14
Joined: Jan 2010
2010-01-13, 03:22:46
(This post was last modified: 2010-01-13, 03:26:46 by martynas.barzda.)
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));
}
Posts: 14
Threads: 5
Joined: Jan 2010
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
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.
Posts: 111
Threads: 14
Joined: Jan 2010
get_content_date('page-name','date format goes here google php date for more info');
Posts: 14
Threads: 5
Joined: Jan 2010
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
not sure whats going on here...
Posts: 14
Threads: 5
Joined: Jan 2010
Posts: 111
Threads: 14
Joined: Jan 2010
I'll check it out in a moment.
Posts: 14
Threads: 5
Joined: Jan 2010
Nijikokun Wrote:I'll check it out in a moment.
hey, did you have any luck looking into it?