Can the carousel be set to show newest object representations?

Does anyone know if there is a configuration setting that would show only the newest objects representations on the home page carousel?

Thanks,

Mark

Comments

  • edited May 14

    Hi Mark,

    As far as I know, not directly. What I know is that you can set this carousel in two manners:

    1. Random objects (default).
    2. Display the content of a specific set of objects. For this, you have to modify the front.conf file to specify which set is used. This file contains:
    #
    # Front page set code
    #
    front_page_set_code = frontPage
    front_page_set_item_caption_template = <l>^ca_objects.preferred_labels.name<br/><small>(^ca_objects.type_id)</small></l>
    front_page_set_random = 0
    

    So on the first parameter front_page_set_code, you give the code of the set you want to use. This code is the one you give when creating a set (see screen capture). You can have more than one set and sometimes change which one is displayed on the front page, just by changing the front_page_set_code.

    If you set front_page_set_random=0, items will be displayed always in the same order as they are in the set.

    If you set front_page_set_random=1, items will be shuffled.

    If front_page_set_code does not correspond to an existing set, the front page will display random objects.

    So one way to show the latest objects in carousel is to create a set and manually add latest objects to it... It's a bit boring. But maybe that will satisfy you.


    There could be another way... but that would require modifying the php code in app/controllers/FrontController.php 😬

    740 x 156 - 25K
  • edited May 14

    I just found an easy way!

    In fact, in app/lib/BaseModel.php, there are these functions:

    getRecentlyAddedItems
    getRecentlyViewedItems
    getMostViewedItems
    getRandomItems
    

    The last one is called in app/controllers/FrontController.php, but you can replace it by getRecentlyAddedItems to display newest objects. To do so:

    1. Make a copy of the app/controllers/FrontController.php file, in case you break something...
    2. Edit this file and find getRandomItems (should be at line 78 or nearby), just replace it by getRecentlyAddedItems.
    3. Save. Reload your front page. Any reload should now always display the same images of newest objects. (It works for me!).


Sign In or Register to comment.