Skip to content

Commit

Permalink
Extended plugin to include a top level galleries list
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Southam committed Jan 17, 2013
1 parent cae79c6 commit 4f410a8
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,49 @@ function exists()

return (int) ($slug ? $this->gallery_m->count_by('slug', $slug) > 0 : FALSE);
}


/**
* Gallery List
*
* Creates a list of galleries
*
* Usage:
*
* {{ galleries:listing limit="5" }}
* <a href="{{ url:base }}galleries/{{ slug }}/{{ id }}" title="{{ name }}">
* <img src="{{ url:site }}files/thumb/{{ file_id }}/75/75" alt="{{ description }}"/>
* </a>
* {{ /galleries:listing }}
*
* The following is a list of tags that are available to use from this method
*
* {{ id }}
* {{ title }}
* {{ slug }}
* {{ folder_id }}
* {{ thumbnail_id }}
* {{ description }}
* {{ filename }}
* {{ extension }}
*
* @return array
*/
function listing()
{
$limit = $this->attribute('limit');
$offset = $this->attribute('offset');

$this->load->model(array(
'gallery_m'
));


$galleries = $this->gallery_m->get_all_with_filename(NULL,NULL,$limit);


return $galleries ? $galleries : array();
}
}

/* End of file plugin.php */

0 comments on commit 4f410a8

Please sign in to comment.