Jump to content

New project a nice growing "kindergarten"


Recommended Posts

Hi Guys,

done a small kindergarten project that works with care on kids only in the wood and outdoor.


It's my second project with PW and learning so much on every project i'm getting better and better with API, modules, using more special tools.... ;)

like on this one first time:

  • AIOM->greatTool
  • MarkupWeather->worksGreat
  • PageProtector + PageRenameOptions for the building time

and AllTimeLovers:

  • AdminCustomPages
  • ChangeImageSelect
  • MarkupSimpleNavigation
  • PageListBetterLabels
  • TemplateDecorator
  • VersionControl
  • MarkupSitemapXML
  • ModulesManager
  • CropImage
  • Changelog
  • ListerPro

The project is a small budget so i'm relying on a individual changed themeforrest template - no own design this time.

With this one i've made my first experience with URL Segments and i love it like everything else in PW!

Worked out a little "archive" script with 80 line of Code and some URL Segments for the /archiv/ as SEG1 and cat or year as SEG2 should work great. Using the PagerMarkup with Somas Code for SEO friendly links - Thanks for this one.

At least thank you all and especially Ryan for making such little happy things possible!


  • Like 9
Link to comment
Share on other sites

Just forgot - i'll always wanna share the interesting parts to this forum so may others can learn something or i can improve something...

i use in my template the delegate approach with a

_init.php and a


for the whole HTML Part....but i've read from Horst about a great and simple solution to split up easy HTML parts for special contents and templates...with this simple lines of code:


$myLayout 	= "default"; 	//default layout


<?php include_once("./layouts/_{$myLayout}.php");?>

So i could use twocol layout if needed mabe if i've subpages:

// If the page has children, then render navigation to them under the body.
// and get the sidebar
$level = count($page->parents);
if ($page->template != "start") {
	if($page->hasChildren || $page->siblings && $level == 2) {
		$myLayout = "twocol";
		$sidebar = "<p>".$page->meta_description."</p>";

or get some more logic together with URL Segments on the mentioned archive page:

// aktiv-root.php template file
// overview - all activities from the kids
//I've /aktuelles/archiv/2014/ or /aktuelles/archiv/kochen/
//segment1 = archiv  ->show the archiv
//segment2 = jahr 	->show the posts from choosen year
//segment2 = kochen	->show the posts from choosen cat

//get all segments for choosing the output/layout!
$seg1 = $sanitizer->pageName($input->urlSegment1);
$seg2 = $sanitizer->pageName($input->urlSegment2);
$seg3 = $sanitizer->pageName($input->urlSegment3);
//get the rootpage of the posts
$aktivroot = $pages->get(1063);
//Load normal akitv_root Layout with isotope view of the last 12 entries!
if (!$seg1) {
	$myLayout = "aktiv_root";
	$headinfo .= "<h5><a href='{$aktivroot->url}archiv/#start' alt='Archiv'>Alle Einträge im Archiv</a></h5>";
//check if we are in /archiv/ first!
if ($seg1 && $seg1 != 'archiv') {
	// unknown URL segment, send a 404
	throw new Wire404Exception();
//check for the third urlsegment not needed
if ($seg3) {
	// unknown URL segment, send a 404
	throw new Wire404Exception();
//get startet to separate the posts in years and categories
if($seg1 == 'archiv') {
	//Load categorie akitv_archiv Layout show all or divided by category or year!!
	$pageNum = $input->get->page ? $input->get->page - 1 : 0;
	$limit = 5;
	$start = $pageNum * $limit;
	$posts = $pages->find("template=aktiv,start=$start,limit=$limit,sort=aktiv_date");
	$myLayout = "aktiv_archiv";
	$headinfo .= "<h2>Alle Einträge im Archiv</h2>";
	if ($seg2){
		if(preg_match('/^(\d{4})$/', $seg2, $matches)) { //Load year View if $seg2 wrong 404
			// A URL segment matched in the format of year-month, i.e. /news/2010-12
			$year = $matches[1];
			$startYear = strtotime("$year-01-01");
			$endYear = strtotime("$year-12-01");
			$now = time();
			//Load dates aktiv_archiv Layput show all posts for a selected year
			$posts = $aktivroot->children("aktiv_date>=$startYear, aktiv_date<$endYear");
			$headinfo  = "";
			$headinfo .= "<h2>Alles aus dem Jahr ". $seg2 ."</h2>";
			if ($posts == ""){
				// not valid category, send a 404
				throw new Wire404Exception();
		} else { //Load cat View if $seg2 wrong 404
			//get all categories
			$cat = $pages->get(1077)->children("include=all");
			//search for the given urlsegment3 as the category
			$catsearch = $pages->get("/site/aktivitaeten-typen/{$seg2}/");
			$found = $cat->filter("id={$catsearch->id}");
				if ($found == ""){
					// not valid category, send a 404
					throw new Wire404Exception();
			// valid category, list items in it
			// Load categorie akitv_archiv Layout with listing of all entries of one category
			$posts = $pages->find("template=aktiv,limit=2,aktivcat={$found},sort=aktiv_date");
			$headinfo  = "";
			if (count($posts)) {
				$headinfo .= "<h2>Alles zum Thema ". $catsearch->title ."</h2>";
			} else {
				$headinfo .= "<h2>Leider keine Artikel zum Thema ". $catsearch->title ." vorhanden!</h2>";
		} //end cat or year view = seg2
	} //end /archiv/ = seg1
} //end output

(may someone find some mistakes i'm not a PHP proffesional - and always open for refactoring.... ;) )

Best regards mr-fan

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...