Theme: Count of total pictures and albums

Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Wed, 2012-05-16 15:34

Sorry, I can't find it, neither in the wiki nor by searching in this forum. I don't doubt there are already many entries for my question ;-)

I'd like to add the number of all pictures and all albums into theme. Which code I have to add? Just the number like in on of the small dashboard-widget.

Best regards
Sebastian

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25957
Posted: Wed, 2012-05-16 15:45

I think the http://codex.gallery2.org/Gallery3:Modules:about_this_album would show total count.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25957
Posted: Wed, 2012-05-16 15:46

or http://codex.gallery2.org/Gallery3:Modules:gallerystats

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Wed, 2012-05-16 15:52

Thank you very much! :-)

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Wed, 2012-05-16 16:02

Okay, I don't want a module to display it in the sidebar. Just the excerpt, just the number to put in the html-meta.

It seems it's something like this I could found in one of the plugins. But how transform it to display the number as a text in theme?

Quote:
$block->content->photo_count = ORM::factory("item")->where("type", "=", "photo")->count_all();

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25957
Posted: Thu, 2012-05-17 01:15

try:
<?= ORM::factory("item")->where("type", "=", "photo")->count_all(); ?>
if that does not work:

<? $item_count = ORM::factory("item")->where("type", "=", "photo")->count_all();
echo $item_count; ?>

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Rockbär
Rockbär's picture

Joined: 2012-04-22
Posts: 76
Posted: Thu, 2012-05-17 16:27

Hey Dave, you made my day! :-) Thank you very much. That helped me a lot! Have a nice day.