Search the Community
Showing results for tags 'bootstrap divs'.
-
So I have found nearly exactly what I am looking for in a pretty old post, but was wondering if someone had a new way that possibly utilized pagination to format a full list of titles. https://processwire.com/talk/topic/1141-multiple-lists-and-loops-into-dynamic-reusable-piece-of-code/ Currently I have a page selector that I am using to select specific "artists". I am attempting to create a very simple list view where I return some of the fields from the pages that have the pagefield as "contemporary" as a link and a rel tag for an image. If I point this to the contemporary section I will recieve 83 results. What I would like to do is simple, if in this case there are 83, then I would like 21 per column, in its own div. any mathys out there wanna help me make a loop? Thanks in advance $out = ""; $pos = 0; //current position in list $out .= '<div class="row">'; //this block counts artists in relevant category based on $dept var set above. //it then will set the amount to be shown per column and how many columns to display based on count if ($dept = "Contemporary"){ $select = "artwork_dept=/departments/contemporary/"; $count = count($pages->get("/artists/")->children($select)); $initCount = $count; $entries = round($count / 4);//entries per line $artists = $pages->get("/artists/")->children($select); $artists = $artists->reverse(); echo $entries; } //grab chunks of artists and loop them in roughly equal amounts $rows = 7; $totalCount = count($jurisdictionsPageChildren); $rowCount = ceil($totalCount / $rows); $mod = $totalCount % $rows; // this will tell us how many rows will have more pages than the others $firstInRow = 0; $i = 1; while ($i <= $rows){ $mainContent .= "<div class='columns six"; if($i == 1) $mainContent .= " alpha"; if($i == $rows) $mainContent .= " omega"; $mainContent .= "'>"; if($i <= $mod){ // do this when we want one more page on the row $sliced = $jurisdictionsPageChildren->slice($firstInRow, $rowCount); $firstInRow += $rowCount; }else{ // do this when we want one less page on the row $sliced = $jurisdictionsPageChildren->slice($firstInRow, $rowCount-1); $firstInRow += $rowCount-1; } foreach($sliced as $p){ $mainContent .= "<h2><a$class href='{$p->url}' title='{$p->title}'>{$p->title}</a></h2>"; } $mainContent .= "</div>"; $i++; } Here is the sample from the original link for reference.