What is best practice for developing different page type layouts in Omeka S?


#1

Hi everyone,

I am new to developing my own theme in Omeka S. What I would like to do, is to set up more than one type of layout.phtml and for a user to be able to choose from the admin section. For instance, I want to set up a layout template for a page type that will display a collection a certain way, with specific metadata fields set up, versus a default page. I also want to be able to have a separate home page because I will developing a full width slider with interactive elements that will be completely different from a typical page. I’ve tried to research on this, but I can’t find any clear cut answers as to what the best practice is. Can anyone please elaborate on how to approach this? Thank you!


#2

I don’t really understand your issue. You can create two different themes and the admin can choose what theme to use.

You can also use conditional statements in your template file with eventually inclusions.

if( isset($user) )
  include 'layout_user.phtml';
else
  include 'layout_standard.phtml';

You can probably test whether the requested page is the home page (and to return a “completely different” page).


#3

I just wanted to give a slightly different perspective. From what I understand, I think @pols12 is right about the different themes. If you want to have collections or item sets displayed differently, then you would create two separate sites within Omeka S where those items will be displayed and assign each site a different theme.

The layout .phtml would be the same for both themes so that you have the same styles and whatnot, but you would need to override a few of the view files. For example the /view/omeka/site/item/show.phtml which is copied from /application/view/omeka/site/item/show.phtml (see http://omeka.org/s/docs/developer/themes/modifying_themes/).

In order to create a full-width slider, I would simply use an Item Showcase block. You can add this block to your ‘home’ page and then add items to it for the showcase.

You can then override the block view in your theme’s folder (/view/common/block-layout/item-showcase.phtml) to display the images from a single item or the primary image from several items in the showcase. This will allow you to have a reusable block that you can put anywhere and update within the Admin rather than hardcoding the slider into a homepage view file.

I’m posting an example here below - just remember it’s still a work in progress, but it shows a very simple slider.


#4

Thank you @fackrellj and @pols12 for your help - although I think I miscommunicated my intentions. I don’t want to create two separate websites, it needs to be self contained. I understand you can use different themes - but what I need to do is create different layout templates for certain PAGES within ONE website theme. From the backend, I want a user to be able to create a page, and then select what type of layout that page will use - I can’t have them manually create a page from scratch. I provided a wireframe that demonstrates just one type of specific page layout I need to program.

I know there are modules in the page builder, but I need to preset specific layouts for users to easily use for specific collections. So for example, in the drawing, you’ll see an image on the left and a text paragraph on the right - normally, one would just use the WISYWIG to manually write text there. But in my case, I need for it to automatically pull from a specific metadata field associated with that image. Also, I’ll need to display thumbnails of images on the bottom which normally you’d use the item showcase, but they need to link to other pages created in the system and not the item level page, which the item showcase module is set to do.

Does this make more sense of what I’m trying to accomplish and is it something that is doable?


#5

Yes, this is doable. To create different layouts that are predefined, I would create a custom module http://omeka.org/s/docs/developer/key_concepts/modules/.

You’ll want to have the module create a new block type that can be added to a page. I might add a new block type for every layout, but you could potentially just have one and then have the user select the layout type from the options.

For the example above, you can have them select one item for the top portion and then have several fields to specify image paths and link locations for the bottom section.

With this approach, your users will be able to create a page and insert your custom block, which can have several layouts predefined and can be customized for each page it’s inserted into.


#6

Ahhh ok, that makes sense. Thanks!


#7

@fackrellj, did you manage to create a one-item showcase with sliding facilities?

I’m trying to overwrite showcase.phtml template to show only one item but I don’t know how to select only one item.

Sorry. I’m new in Omeka-S

Thanks in advance.
Kind Regards,
Jose A.