Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get content published in other page
#1
Hi, and thanks for this great CMS.

I'm trying to find a solution to build a kind of "Events page" where I could post new events as they happen.
For exemple :
Quote:Events :

05/05/2009 Event 3
During this event ...

03/03/2009 Event 2
During this event ...

01/01/2009 Event 1
During this event ...

I don't want to edit the "Events page" each time there is a new event Cool , so I think it could be interesting to have functions in theme editing to get child pages and content of those pages :

The structure of pages would be :
* Events page
** Event 3
** Event 2
** Event 1

and the theme for "Events page" would do something like this :

Code:
foreach (get_children(current_page) as $child) {
   echo $child->get_title();
   echo $child->get_content();
}

I hope what I tried to explain is quite clear (I'm french :/ )
Maybe it is already possible ?

Thanks !!
Reply
#2
I'm looking for the same functionality...
if i find a solution i will post here the code
Reply
#3
Ok! i made it...

just use menu_data function and parent_slug tag:

i manage an old function discovered in an old post:

The getSubpagesList function (put in your functions.php theme file):

Code:
<?php        
    function getSubpagesList($parent) {

    $data = menu_data();    
    $parent = $parent . "/";
    $output = array();

    $output[] = '<ul>';
    
    foreach( $data as $menu) {
        if ($menu['parent_slug'] == $parent){
            $output[] = "<li><a href='" . $menu['url'] . "' title='" . $menu['title'] . "'>"
                                                    . $menu['title'] . $menu['parent'] . "</a></li>";
        }
    }
    $output[] = '</ul>';

    $menu_string = implode("\n", $output);
    echo $menu_string;
}    
        
?>

You can call where you want passing the slug of the parent page:

Code:
<?php getSubpagesList('events');?>


It shows all the pages with a particular parent slug
Reply
#4
Should this be moved to Scripts & Components Category?

Peace.

homershines
Reply
#5
good idea... moved it there now.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#6
Hi Webquadro, thanks for your sharing your code !
I have tried and works great

a little thing..
on the event template file, you better call it by a dinamic code like:

Code:
<?php getSubpagesList( return_page_slug() );?>

and something nice, adding this code on the sidebar, with a few UL - List, we have the second level browsing...

isnt it simple ?
Reply
#7
focoves Wrote:We have the second level browsing...
You do realise we have had that for about a month now? Multi-level navigation has even been implemented on some sites in the show section of the forum. You can find it here, as multi-level navigation.

Uses the same idea, and generates all the lists with CSS classes ready for use.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#8
Hi Zegnåt,
yes, it is a good point cheking a few on the past ... it is a bad practice giving a view just to updates.. sorry Smile
I have tested your Mastering Navigation ... is OK ! well done Smile
I am now trying to work with css to show a good result
thank you. x
Reply
#9
Hi Webquadro,
call me stupid, but I cannot understand how should I use your function... Maybe because I'm pretty illitterate when it comes to php Smile
I mean, I'd like to have an homepage with a listing of recent news. I make the homepage template just like the default template, but instead of
Code:
<?php get_page_content(); ?>
I put
Code:
<?php getSubpagesList('news');?>
.
Then I create various pages with my news content, and make all those pages child of the homepage, right?
Thank you for your help...
Reply
#10
Greetings Melmoth.

I also have had some difficulty with following function instructions and I know it's pilot error. Anyway, you can get news into your site another way. I use NewsOffice in my GS work and I just make another template [I call it News.php or whatever] I use it as my home page and I add the php for the news script below the get_page_content(); php like this...

<div id="bodycontent">

<div class="post">
<h1><?php get_page_title(); ?></h1>
<div class="postcontent">
<?php get_page_content(); ?>


<!-- // News Office Script //-->

<?php
$selected_category = "1";
$theme_selected = "default";
include('/Users/me/webdesignwork/GetSimpleA/myplugins/newsoffice/news_show.php');
?>

The example uses the Default_Simple theme.

You can find NewsOffice here...
http://newsoffice.newanz.com/?page=home


I got some help early on from Pixelita and Chris. [Many Thanks again.]
Peace.

homershines
Reply
#11
Thank you homershines.
It seems you found a smart solution, I think I'll go that route. But I'd like something simplier than newsoffice. I found micronews, which is fantastic, but doesn't let you modify an existing news, you can just create a new one (with a WYSIWYG editor)... Let's see if I can find something that simple and small, but just a tiny bity more complete.
Reply
#12
Try these...

http://www.phpfastnews.com/

http://www.planetluc.com/en/scripts_mynews.php

http://www.easyphpscripts.com/?Page=EasyPHPNews

phpFastNews is probably the easiest to set up.

peace.

homershines
Reply
#13
Thank you homershines for your suggestions. I had already tried them, but I can't get 'em to work... I include the page, but it doesn't show up correctly (and sometimes the layout is messed up, too).

Maybe I'll try your first suggestion (newsoffice) in the end Smile
Reply
#14
@webquadro: Thank you for the submenu function. I had some trouble with the list. Code was not valid. Fixed it like this:
Code:
//****************************************************//
//** FUNCTION: get_subpages()                       **//
//**                                                **//
//** Function to display subpages.                  **//
//****************************************************//
function get_subpages($parent) {
    $data = menu_data();    
    $parent = $parent . "/";
    $output = array();

    foreach( $data as $menu) {
        if ($menu['parent_slug'] == $parent){
            $output[] = "<li><a href='" . $menu['url'] . "' title='" . $menu['title'] . "'>"
                                                    . $menu['title'] . $menu['parent'] . "</a></li>";
        }
    }
    
    $menu_string = implode("\n", $output);
    if ($menu_string != "") {
    echo "<ul>".$menu_string."</ul>"; }
    }
Simplify, optimize, minimalize but keep the core.
Reply
#15
Philipp Speck Wrote:Fixed it like this
Please note that your code will probably break in the next GetSimple version. I already talked about the problem in that same topic. Parent value will no longer need to end in a slash (/).
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#16
Hmm... this don't work for me. I use GetSimple 2.03 and i want to make a editable contentslider like http://www.panic.com/coda/
My idea was to make a page with Subpages and generate the unordered list from the subpages. Good idea?? - Or is there a better way to realize it. Somebody did it? It has to be editable without knowledge of HTML (so not with components, that would be the easy way Wink)
Reply
#17
Hi,

Thats the way I would do it, and have done here

http://pmc.digimute.com

Also uses my CustomFields Plugin to specify the Headings and Images.

Text for the pages is editable as normal pages.
My Github Repos: Github
Website: DigiMute
Reply
#18
Yeah, that is exactly what I need.

I am new with GetSimple - I love it because its so easy for Users to handle their content. So, I try to make my first page with it and it's a bit hard - normally I use Typo3. Would you pleaaaaase post the function which is needed to read the content from the subpages? Wink Would be very nice from you... Custom Fields I will test!

Thank you!
Reply
#19
Here it is, I've removed all the Customfields code.

In my example I've created a page called "portfolio"
then created all the subpages with the parent set to "portfolio"

Just style the output to what you need.

Mike..
Code:
function getPortfolio(){
    global $PRETTYURLS;
    global $SITEURL;    
    $path = "data/pages";
        $dir_handle = @opendir($path) or die("Unable to open $path");
        $filenames = array();
        while ($filename = readdir($dir_handle)) {
            $filenames[] = $filename;
        }
        $pagesArray = array();
        if (count($filenames) != 0) {
            foreach ($filenames as $file) {
                if ($file == "." || $file == ".." || is_dir("data/pages/".$file) || $file == ".htaccess"  ) {
                    // not a page data file
                } else {
                    $thisfile = @file_get_contents('data/pages/'.$file);
                    $data = simplexml_load_string($thisfile);
                    
                    //change portfolio to your top page name....
                    if ($data->parent == 'portfolio' && $data->private!="Y") {

                    echo "<li>";                      
                        echo stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));
                       echo "</li>";    
                        
                    }
                }
            }
        }
    
}
My Github Repos: Github
Website: DigiMute
Reply
#20
Mike, you are great!! - Thank you so much! Tomorrow I will check how to integrate your custom field plugin. Today I learned enough *hihi*

Greetings from Austria!
Georg.
Reply




Users browsing this thread: 1 Guest(s)