Pages > Home edit page and find Global site settings. * * @param Page $page - instance of the page. * @return String - html markup string of copyright statement */ setlocale(LC_NUMERIC, 'en_US.UTF-8'); ######################################################### # getter ######################################################### /** * getTag() * * @param PageArray $tags - instance of PageArray * @param int $limit - limit of the output * @return string - html markup string of Tag list elements. */ function getTag(PageArray $tags, $limit = 0){ $list = ""; $count = "0"; foreach($tags as $tag){ $count++; if($count > $limit && $limit != 0) break; $title = $tag->title; $list .= "
  • $title
  • "; } return $list; } function getPageArray($posts){ // Erzeuge ein Array aus $posts if(!$posts instanceof PageArray){ if($posts instanceof Page){ $post = $posts; $posts = new PageArray(); $posts->add($post); } else if(empty($posts)){ $post = wire('page'); $posts = new PageArray(); $posts->add($post); } else if(is_string($posts)){ // selector string $selector = $posts; $posts = wire('pages')->find("$selector"); } } return $posts; } ################################################### # Render #################################################### function renderPage($template = "") { if(empty($template)) $template = wire('page')->template; $config = wire('config'); //Create delegate template $template = new TemplateFile($config->paths->templates . "markup/$template.inc"); //Get the output and save it on $out. return $template->render(); } /* Alternative zur obigen Lösung: function renderPage($posts = "", $small = false){ if(!$posts instanceof PageArray){ if($posts instanceof Page){ $post = $posts; $posts = new PageArray(); $posts->add($post); } else if(empty($posts)){ $post = wire('page'); $posts = new PageArray(); $posts->add($post); } else if(is_string($posts)){ // selector string $selector = $posts; $posts = wire('pages')->find("$selector"); } } $out = ''; foreach ($posts as $p) { switch($p->template){ case 'post': $out .= renderPost($p, $small); break; case 'node': $out .= renderEvent($p, $small); break; case 'router': $out .= renderRouter($p, $small); break; case 'profile': $out .= renderProfile($p, $small); break; } } if($posts->getLimit() < $posts->getTotal()) $out .= $posts->renderPager(array( 'nextItemLabel' => "Ältere Artikel", 'previousItemLabel' => "Neure Artikel", )); return $out; } */ function renderCopyrights(Page $page) { if (!$page->summary) return ''; $text = str_replace( // find these: array('{year}'), // and replace with these: array(date('Y')), // in the copyright_text text $page->summary); return $text; } function renderTimeline($timeline){ // Überprüfe ob $timeline von der richtigen Instants ist if(!$timeline instanceof PageArray) { if($timeline instanceof Page){ //single page $post = $timeline; $timeline = new PageArray(); $timeline->add($post); } else if(is_string($timeline)) { // selector string $selector = $timeline; $timeline = wire('pages')->find("template=post, sort=-date, $selector"); } else { throw new WireException('getTimeline requires a PageArray, Page or selector string'); } } // Count for the while Schleife $count = 0; $timeline_blocks = ''; $config = wire('config'); foreach($timeline as $post){ $image = $post->images->first(); $t = new TemplateFile($config->paths->templates . "markup/timeline_block.inc"); $t->set('title', $post->date); $t->set('subtitle', $post->title); $t->set('summary', $post->summary); $t->set('image', $post->images->first()->size(156,156)->url); $t->set('image_description', $image->description); $t->set('readmore', $post->httpUrl); $t->set('leftright', ($count % 2 != 0 ? "" : "class='timeline-inverted'")); $timeline_blocks .= $t->render(); $count++; } $t = new TemplateFile($config->paths->templates . "markup/timeline.inc"); $t->set('timeline_blocks', $timeline_blocks); return $t->render(); } /* Vorbereitung für Landingpages einzelner Communitys */ function renderOnPageBlocks() { // Get the current page instance from global scope. $page = wire('page'); // Get the config instance from global scope. $config = wire('config'); if (!count($page->on_page_blocks)) return ''; /* Get on-page blocks */ $pageBlocks = $page->on_page_blocks; $out = ''; foreach ($pageBlocks as $block) { //Create delegate template $template = new TemplateFile($config->paths->templates . "markup/page-block-type-{$block->render_option}.inc"); //Assign the rendered view to content variable to show up on page-block-type-x.inc $template->set('image', $block->image); $content = str_replace( // find these: array('