Is it possible to count and display how many images are in the current album?
With this code I can count all images in my Gallery: <?= t("Images: %count", array("count" => ORM::factory("item")->where("type", "photo")->count_all())) ?>
But what I have to change to use this at gallery3/themes/default/view/header.html.php
Now I only get "Photos - /"
rWatcher
Joined: 2005-09-06
Posts: 722
Posted: Sun, 2009-07-26 18:04
vallu wrote:
Is it possible to count and display how many images are in the current album?
With this code I can count all images in my Gallery: <?= t("Images: %count", array("count" => ORM::factory("item")->where("type", "photo")->count_all())) ?>
You need to specify the album id. Something like: <?= t("Images: %count", array("count" => ORM::factory("item")->where("type", "photo")->where("parent_id", $item->id)->count_all())) ?>
Where $item->id is the ID# of the album.
vallu
Joined: 2009-06-04
Posts: 25
Posted: Sun, 2009-07-26 19:39
rWatcher wrote:
You need to specify the album id. Something like: <?= t("Images: %count", array("count" => ORM::factory("item")->where("type", "photo")->where("parent_id", $item->id)->count_all())) ?>
Where $item->id is the ID# of the album.
Thank you, that is what I'm looking for! Works fine for me.
Posts: 16504
Why do all that. Just take a look at gallery3/themes/default/view/pager.html.php
The information is already there.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 25
Thanks for reply. You mean this code:
But what I have to change to use this at gallery3/themes/default/view/header.html.php
Now I only get "Photos - /"
Posts: 722
You need to specify the album id. Something like:
<?= t("Images: %count", array("count" => ORM::factory("item")->where("type", "photo")->where("parent_id", $item->id)->count_all())) ?>
Where $item->id is the ID# of the album.
Posts: 25
Thank you, that is what I'm looking for! Works fine for me.