So I have a custom module where there is a basic function that returns an array of data where I try to add a pager. I then call the function in the template.php the pass a custom variable to my template file. A listing appears there, with the working pagination to say so, but the list items are displayed weird. All the data is added as a HTML attribute.
This is how I create the pager from my function:
$result = Array(
array(0)
tile
author
array(1)
tile
author
array(2)
tile
author
array(3)
tile
author
....
$total = count($result);
$num_per_page = 12;
// Initialize pager and gets current page
$current_page = pager_default_initialize($total, $num_per_page);
// Split the items up into chunks:
$chunks = array_chunk($result, $num_per_page);
// Get the items for our current page:
$current_page_items = $chunks[$current_page];
// Theme each item. Note that the theme
// some_theme_hook is left out of this tutorial
// for simplicity
foreach($current_page_items as $i => $item) {
$current_page_items[$i] = array(
'#item' => $item,
);
}
// Generate the render array for our page
$render_array['page'] = array (
'#theme' => 'item_list',
'#items' => $current_page_items,
);
// Calls Drupal standard pager theme and set 5 page links on pager
$render_array['pager'] = array (
'#theme' => 'pager',
'#quantity' => 5,
);
return $render_array;
And this is my rendered markup:
<li #item="http://localhost.../sites/default/files/styles/videos_page/public/16-Inside-03-L.jpg?itok=PXCk5oXs Inside the Track #3 watch for $123 Michael Brauer The Rides Game on Series new 1:20:00" class="first">
</li>
Any ideas of how can I manage this?