GetSimple Support Forum
get_page_content('pageID'); - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: get_page_content('pageID'); (/showthread.php?tid=2282)



get_page_content('pageID'); - glennb - 2011-10-15

Hi

I have project where I need multiple content on 1 page.
To keep this manageable, I would like to keep each part of content in a different page.
Designer wanted it to be a fancy 1 full jquery-animated page -_-

Now, is there a fast way or module to get page content by giving for example an extra parameter to the function in stead of the default by page slush.
Like: get_page_content('page2');

I don't feel like hacking the core though :/

Thanks guys!


get_page_content('pageID'); - n00dles101 - 2011-10-15

Hi,

You will be able to do this in 3.1 but as thats not released yet..
you can add the follwoing function to your themes 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));;
}

then just use get_content('pageslug');

hope it helps....

Mike.


get_page_content('pageID'); - glennb - 2011-10-15

n00dles, thanks for the reply.

It works like a charm and should be in core. Good to hear it's in the 3.1.


get_page_content('pageID'); - n00dles101 - 2011-10-15

yup will work for all versions.

version 3.1 will include the follwoing new functions.

http://get-simple.info/wiki/config:caching-function

Mike..


get_page_content('pageID'); - yojoe - 2011-10-16

I once used Mike's funciton, but I had to modify it a bit, to see if user didn't delete accidentially one of essential pages, thus:
Code:
function load_page_content($id){
    $file = "data/pages/". $id .".xml";
    if ( file_exists($file) ){
        $data_index = getXML($file);        
        $page=stripslashes( html_entity_decode($data_index->content, ENT_QUOTES, 'UTF-8') );
    }else{
        $page="Page ".$id." doesn't exist";
    }
    
    return $page;
}



get_page_content('pageID'); - mvlcek - 2011-10-16

glennb Wrote:Now, is there a fast way or module to get page content by giving for example an extra parameter to the function in stead of the default by page slush.
Like: get_page_content('page2');

If you use the I18N plugin, you can use get_i18n_content('page2') - it outputs the page and returns true if the page exists, false otherwise.