$minutes = date("i"); $colour = "a"; $videocolour = "9917F4"; if ($minutes > 10) { $colour = "b"; $videocolour = "1BDF65"; } if ($minutes > 20) { $colour = "c"; $videocolour = "FB5757"; } if ($minutes > 30) { $colour = "d"; $videocolour = "18FCE9"; } if ($minutes > 40) { $colour = "e"; $videocolour = "E1FA56"; } /* if ($minutes > 50) { $colour = "f"; $videocolour = "1D367D"; } */ if ($minutes > 50) { $colour = "f"; $videocolour = "ABA8A8"; } if (isset($_GET["colour"])) { $colour = $modx->stripTags($_GET["colour"]); if ($colour == "b") { $videocolour = "1BDF65"; } if ($colour == "c") { $videocolour = "FB5757"; } if ($colour == "d") { $videocolour = "18FCE9"; } if ($colour == "e") { $videocolour = "E1FA56"; } /* if ($colour == "f") { $videocolour = "1D367D"; } */ if ($colour == "f") { $videocolour = "ABA8A8"; } } $modx->setPlaceholder('colour', $colour); $modx->setPlaceholder('videocolour', $videocolour); $current_year = date("Y"); $modx->setPlaceholder('current_year',$current_year); Provoke & Inspire
bleet

Provoke & Inspire

$number_per_page = 10; function sort2d ($array, $index, $order='asc', $natsort=FALSE, $case_sensitive=FALSE) { if(is_array($array) && count($array)>0) { foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; if(!$natsort) ($order=='asc')? asort($temp) : arsort($temp); else { ($case_sensitive)? natsort($temp) : natcasesort($temp); if($order!='asc') $temp=array_reverse($temp,TRUE); } foreach(array_keys($temp) as $key) (is_numeric($key))? $sorted[]=$array[$key] : $sorted[$key]=$array[$key]; return $sorted; } return $array; } $ret = ""; $compiled_array = array(); $posts_folder = 5; $children = $modx->db->select( '*', 'modx_site_content', 'published = 1 and deleted = 0 and parent = '.$posts_folder.' ', ''); while ($childdoc = $modx->db->getRow($children)) { $posts_tvs = $modx->getTemplateVarOutput(true,$childdoc["id"]); $posts_pageinfo = $modx->getPageInfo($childdoc["id"],1,'pagetitle'); if ($posts_tvs["post_hide"] != 1) { $date_array = explode(".",$posts_tvs["post_date"]); $formatted_date = $date_array[2]."-".$date_array[1]."-".$date_array[0]; $temp_array = array("post_title" => $posts_pageinfo["pagetitle"], "post_date" => $posts_tvs["post_date"], "formatted_date" => $formatted_date, "post_text" => $posts_tvs["post_text"], "post_type" => $posts_tvs["post_type"], "post_video_type" => $posts_tvs["post_video_type"], "post_video_code" => $posts_tvs["post_video_code"], "post_video_width" => $posts_tvs["post_video_width"], "post_video_height" => $posts_tvs["post_video_height"], "post_large_image" => $posts_tvs["post_large_image"], "post_image_1_thumb" => $posts_tvs["post_image_1_thumb"], "post_image_1_large" => $posts_tvs["post_image_1_large"], "post_image_2_thumb" => $posts_tvs["post_image_2_thumb"], "post_image_2_large" => $posts_tvs["post_image_2_large"], "post_image_3_thumb" => $posts_tvs["post_image_3_thumb"], "post_image_3_large" => $posts_tvs["post_image_3_large"], "post_image_4_thumb" => $posts_tvs["post_image_4_thumb"], "post_image_4_large" => $posts_tvs["post_image_4_large"], "post_image_5_thumb" => $posts_tvs["post_image_5_thumb"], "post_image_5_large" => $posts_tvs["post_image_5_large"], "post_image_6_thumb" => $posts_tvs["post_image_6_thumb"], "post_image_6_large" => $posts_tvs["post_image_6_large"], "post_image_7_thumb" => $posts_tvs["post_image_7_thumb"], "post_image_7_large" => $posts_tvs["post_image_7_large"], "post_image_8_thumb" => $posts_tvs["post_image_8_thumb"], "post_image_8_large" => $posts_tvs["post_image_8_large"], "post_image_9_thumb" => $posts_tvs["post_image_9_thumb"], "post_image_9_large" => $posts_tvs["post_image_9_large"], "post_image_10_thumb" => $posts_tvs["post_image_10_thumb"], "post_image_10_large" => $posts_tvs["post_image_10_large"]); $compiled_array[] = $temp_array; } } $compiled_array = sort2d($compiled_array,"formatted_date",'desc'); if (isset($_GET["page"])) { $page = $modx->stripTags($_GET["page"]); } else { $page = ""; } if (!is_numeric($page)) { $page = ""; } if ($page < 1) { $page = ""; } if ($page !=ceil($page)) { $page = ""; } $max_pages = ceil(count($compiled_array)/$number_per_page); if ($page > $max_pages) { $page = ""; } if ($page == "" || $page == 1) { $ret .= "
\n"; $ret .= "

This is the personal blog of Andrew Thomas, Digital Designer for positive. Currently living and working in Bristol, UK. He loves type, robots, films and all creative ideas. In other news… he doesn't like it when it gets hot and occasionally speaks in the third person.

"; $ret .= "
\n"; /* $ret .= "
\n"; $ret .= "
\n"; $ret .= "

Manifesto

\n"; $ret .= "
\n"; $ret .= "\n"; $ret .= "\n"; $ret .= "
\n"; $ret .= "
\n"; $ret .= "
\n"; $manifesto_page = 1; $manifesto_tv = $modx->getTemplateVarOutput(true,$manifesto_page); $ret .= $manifesto_tv["manifesto"]; $ret .= "
\n"; $ret .= "
\n"; */ $page = 1; } $offset = 0; if ($page != "") { $offset = $number_per_page * ($page-1); } $startpoint = 0 + $offset; $endpoint = $number_per_page + $offset; if ($endpoint > count($compiled_array)) { $endpoint = count($compiled_array); } for ($list=$startpoint; $list<$endpoint; $list++) { switch ($compiled_array[$list]["post_type"]) { case "text": // text only $ret .= "
\n"; $ret .= "

".$compiled_array[$list]["post_title"]."

\n"; $ret .= "

".$compiled_array[$list]["post_date"]."

\n"; $ret .= $compiled_array[$list]["post_text"]; $ret .= "
\n"; break; case "video": // video $video_code = $compiled_array[$list]["post_video_code"]; $video_width = $compiled_array[$list]["post_video_width"]; $video_height = $compiled_array[$list]["post_video_height"]; $scaled_height = round((496 * $video_height) / $video_width); $ret .= "
\n"; $ret .= "
"; // vimeo $ret .= "\n"; $ret .= "
\n"; $ret .= "

".$compiled_array[$list]["post_title"]."

\n"; $ret .= "

".$compiled_array[$list]["post_date"]."

\n"; $ret .= $compiled_array[$list]["post_text"]; $ret .= "
\n"; break; case "large": // large image $ret .= "
\n"; $ret .= "
"; $ret .= "\n"; $ret .= "
\n"; $ret .= "

".$compiled_array[$list]["post_title"]."

\n"; $ret .= "

".$compiled_array[$list]["post_date"]."

\n"; $ret .= $compiled_array[$list]["post_text"]; $ret .= "
\n"; break; case "many": $ret .= "
\n"; $ret .= "
\n"; $ret .= "
\n"; $ret .= "
    "; if ($compiled_array[$list]["post_image_1_thumb"] != "" && $compiled_array[$list]["post_image_1_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_2_thumb"] != "" && $compiled_array[$list]["post_image_2_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_3_thumb"] != "" && $compiled_array[$list]["post_image_3_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_4_thumb"] != "" && $compiled_array[$list]["post_image_4_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_5_thumb"] != "" && $compiled_array[$list]["post_image_5_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_6_thumb"] != "" && $compiled_array[$list]["post_image_6_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_7_thumb"] != "" && $compiled_array[$list]["post_image_7_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_8_thumb"] != "" && $compiled_array[$list]["post_image_8_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_9_thumb"] != "" && $compiled_array[$list]["post_image_9_large"] != "") { $ret .= "
  • "; } if ($compiled_array[$list]["post_image_10_thumb"] != "" && $compiled_array[$list]["post_image_10_large"] != "") { $ret .= "
  • "; } $ret .= "
\n"; $ret .= "
\n"; $ret .= "
"; $ret .= "
\n"; list($img_width, $img_height, $img_type, $img_attr) = getimagesize($compiled_array[$list]["post_image_1_large"]); $ret .= "\n"; $ret .= "
"; $ret .= "

".$compiled_array[$list]["post_title"]."

\n"; $ret .= "

".$compiled_array[$list]["post_date"]."

\n"; $ret .= $compiled_array[$list]["post_text"]; $ret .= "
\n"; break; } } // pagination if ($max_pages > 1) { $this_id = $modx->documentObject['id']; $first = $startpoint+1; $last = $endpoint; $this_pageinfo = $modx->getPageInfo($this_id,1,'alias'); $this_alias = $this_pageinfo["alias"]; $ret .= "
\n"; //$ret .= "

Showing ".$first." - ".$last." of ".count($compiled_array)."

\n"; $ret .= "
\n"; if ($page > 1) { // show previous $page_value = $page - 1; $ret .= "\n"; } else { //$ret .= "
\n"; } if ($page < $max_pages) { // show next $page_value = $page + 1; $ret .= "\n"; } else { //$ret .= "
\n"; } $ret .= "
\n"; $ret .= "
\n"; } echo $ret;