Display one collection


#1

Hello,
i would like to display one collection with an id that interests me, there are maybe method to do it?
I found something like get_record_by_id, but when I echo get_record_by_id(‘collection’, 10) it return me an error
Could someone help me?


#2

Depending on where on the site you want to do it, you can use shortcodes


#3

It would be something like this? <?php echo [collections id=10] ?>


#4

As in the linked documentation, you could enter it directly into a simple page with [collections id=3]


#5

Unfortunately, as I’m doing this, the shortcode shows up as plain text, the next thing is that I want to edit my own index.php file and there to display one collection with the desired id

As Omeka Team member, could you tell me that:
Can I in Omeka at my homepage display 3 collections with specific id? It is possible? Example:
I want do display:
3 divs with 3 collection(title and description) with specific ids:

Collection id =10 title Collection id =10 desc
Collection id =3 title Collection id =3 desc
Collection id =12 title Collection id =12 desc

It is possible to do it?


#6

Shortcodes work on an Simple Page. So they would not work if you’re actively editing the php file. They’re meant to simplify the process so that you don’t have to work on the index file.


#7

OK, but there is a chance to do what I told you in the php way with omeka?
"I want do display:
3 divs with 3 collection(title and description) with specific ids:

Collection id =10 title Collection id =10 desc

Collection id =3 title Collection id =3 desc

Collection id =12 title Collection id =12 desc"


#8

What error were you getting when you tried your first approach? get_record_by_id is the proper function to use to get a Collection with a specific ID… though to print its title and description you’d want to take that collection, save it in a variable, and pass that to the metadata function, rather than trying to echo the collection itself.


#9

OK now I get it, I’ve done somthing like this, and its worked for me:

<?php $collection6 = get_record_by_id('Collection', 6);?>
<?php echo metadata($collection6, array('Dublin Core', 'Description'), array('snippet'=>45)); ?>

Thank you very much for your answer jflatnes!


#10

Hey jflatnes, sorry to bother but maybe you have some thoughts about this issue?

It’s related with collections and CollectionTree plugin
I want to display all collections from parent collection
Maybe you could help, or have some ideas how to resolve it?
Regards