Forums » Display total# Items in Omeka 2.0

RSS feed for this topic

Info

  1. Hello,

    I used to use the total_items function in Omeka 1x to display a count of all public Items on my theme home page. Example: <?php echo 'Total casualties posted to date:&nbsp;'. total_items() .'.'; ?>

    Functions have changed in 2.0. I see that the new function is total_records and that I am supposed to reference a recordType. I am a bit lost on the recordType and if I need to first declare that function.

    Thank you.

  2. Just trying to go with <?php echo 'Total casualties posted to date: '. total_records() .'.'; ?> did not work; it broke my home page.

  3. total_records() wants a type for the records. Something like this:

    <php
    echo total_records('Item');
    ?>

    will print the total number of Items available.

    Generally, in the switch from 1.x to 2.x, the functions are generalized, with the first parameter as the record type, which was built into the function name. So

    total_items();

    becomes

    echo total_records('Item');
  4. Thanks, Patrick! I messed up and original tried to use "Items", which did not work. And thanks for the explanation of functions in 1 vs 2.

  5. No problem. I think there are functions in Omeka where either 'Item' or 'Items' works, and it isn't always clear where one won't work.

The forums are closed to new posts. To post new topics and read the latest discussions, please see the new forums.