Posts: 1
Threads: 1
Joined: Aug 2009
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 , 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 !!
Posts: 8
Threads: 1
Joined: Dec 2009
I'm looking for the same functionality...
if i find a solution i will post here the code
Posts: 8
Threads: 1
Joined: Dec 2009
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
Posts: 104
Threads: 15
Joined: Oct 2009
Should this be moved to Scripts & Components Category?
Peace.
homershines
Posts: 1,848
Threads: 86
Joined: Aug 2009
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!
Posts: 41
Threads: 3
Joined: Dec 2009
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 ?
Posts: 972
Threads: 27
Joined: Aug 2009
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.
Posts: 41
Threads: 3
Joined: Dec 2009
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
I have tested your Mastering Navigation ... is OK ! well done
I am now trying to work with css to show a good result
thank you. x
Posts: 6
Threads: 0
Joined: Feb 2010
2010-02-04, 22:03:52
(This post was last modified: 2010-02-04, 22:04:33 by binaryorganic.)
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
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...
Posts: 104
Threads: 15
Joined: Oct 2009
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
Posts: 6
Threads: 0
Joined: Feb 2010
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.
Posts: 104
Threads: 15
Joined: Oct 2009
Posts: 6
Threads: 0
Joined: Feb 2010
2010-02-10, 19:32:26
(This post was last modified: 2010-02-11, 18:41:55 by binaryorganic.)
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
Posts: 10
Threads: 1
Joined: Feb 2010
@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.
Posts: 972
Threads: 27
Joined: Aug 2009
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 (/).
Posts: 6
Threads: 1
Joined: Sep 2010
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 )
Posts: 1,108
Threads: 70
Joined: Aug 2009
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.
Posts: 6
Threads: 1
Joined: Sep 2010
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? Would be very nice from you... Custom Fields I will test!
Thank you!
Posts: 1,108
Threads: 70
Joined: Aug 2009
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>";
}
}
}
}
}
Posts: 6
Threads: 1
Joined: Sep 2010
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.
|