Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pulling child page info
#1
Hello,
So i have successfully used this: http://get-simple.info/forums/showthread.php?tid=6629

In order to pull page content and then i created a function to pull the page title as well

Code:
function getPageTitle($page,$field='title'){

    $thisfile = file_get_contents(GSDATAPAGESPATH.$page.'.xml');
    $data = simplexml_load_string($thisfile);
    $title = stripslashes(htmlspecialchars_decode($data->$field, ENT_QUOTES));
    if ($field=='title'){
        $title = exec_filter('title',$title);
    }
    echo $title;
}

and i can now use:
<?php getPageTitle($child); ?>

So, now all i need to do is pull the date for the child pages.
However, i can't figure out how to do a function to be able to pull the child page date because the date function is created in theme_functions and not caching_functions.

So how would i go about pulling the child pages correct date?
Currently i can either display the main pages date or what is currently displaying.

[Image: mZACkrA.png]


If someone could help me in pulling the child pages date without any plugins that would be great Big Grin
Since i don't want to have to go through and manually add pages to the file. I want it done automatically so this is why I'm doing it this way.

Thanks
- Alex
Reply
#2
(2015-09-13, 06:44:25)alex809 Wrote: Hello,
So i have successfully used this: http://get-simple.info/forums/showthread.php?tid=6629

In order to pull page content and then i created a function to pull the page title as well



Code:
function getPageTitle($page,$field='title'){

    $thisfile = file_get_contents(GSDATAPAGESPATH.$page.'.xml');
    $data = simplexml_load_string($thisfile);
    $title = stripslashes(htmlspecialchars_decode($data->$field, ENT_QUOTES));
    if ($field=='title'){
        $title = exec_filter('title',$title);
    }
    echo $title;
}

and i can now use:
<?php getPageTitle($child); ?>

So, now all i need to do is pull the date for the child pages.
However, i can't figure out how to do a function to be able to pull the child page date because the date function is created in theme_functions and not caching_functions.

So how would i go about pulling the child pages correct date?
Currently i can either display the main pages date or what is currently displaying.

[Image: mZACkrA.png]


If someone could help me in pulling the child pages date without any plugins that would be great Big Grin
Since i don't want to have to go through and manually add pages to the file. I want it done automatically so this is why I'm doing it this way.

Thanks
- Alex

See this post http://get-simple.info/forums/showthread...9#pid46969
Use getPageField  function to get needed fields from child pages. Smile
Reply
#3
(2015-09-17, 17:16:03)DimaYakovlev Wrote: See this post http://get-simple.info/forums/showthread...9#pid46969
Use getPageField  function to get needed fields from child pages. Smile

I got the code from that thread.. http://get-simple.info/forums/showthread...1#pid46971

That isn't gonna help me pull the child pages date. I already got the child page titles and content.

As you can see.
PHP Code:
<?php getPageField($child'date'); ?>

Returns nothing: [Image: JW9wZVf.png]
Reply
#4
its pubDate
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
(2015-09-19, 03:04:31)shawn_a Wrote: its pubDate

Ok, It works Big Grin
Now how do i get it to display properly? Lol

[Image: Xhacthx.png]
PHP Code:
<div class="published-date"><?php getPageField($child'pubDate'); ?></a></div> 
Reply
#6
PHP Code:
<?php echo date('d-m-Y'strtotime(returnPageField($child'pubDate'))); ?>
Reply
#7
(2015-09-19, 05:54:45)Carlos Wrote:
PHP Code:
<?php echo date('d-m-Y'strtotime(returnPageField($child'pubDate'))); ?>

Thanks.

I simply switched it to
PHP Code:
<?php echo date('F jS, Y'strtotime(returnPageField($child'pubDate'))); ?>

Actually displays the proper date now Big Grin
Reply




Users browsing this thread: 1 Guest(s)