I cannot override a page layout

Hi.

I was trying to override the home page layout. I was aware that saving a template in site/page/home.phtml could override the page layout or create the content that in $this->content used in the layout.phtml.
Although the manual suggests that “Subfolders correspond to the pages that are seen along url patterns”, it does not work.
Then I tried to override other pages, such as {base url}/page/test with a layout in view/omeka/site/page/test.phtml in my theme with no effects.

Am I wrong?
Can only the layout of specific parts, such as item and item-set be defined?
Is it not possible to define the layout of the home page?
From where does the content of $this->content come?
Is the path suggested in the documentation “subfolders correspond to the pages that are seen along url patterns” correct?

I have omeka-s, and I have set a default website.

Thank you.

Nicola.

You’re looking at documentation for Omeka Classic there, not Omeka S, as best I can tell (though if I’m wrong, please point me at the documentation page you’re looking at).

To a certain extent, like for the pages for viewing and browsing items, sets, and media, the files do follow a structure parallel to the URL. But pages, the pages the user can edit and pick the name and slug of, those work a little differently and the view file they use doesn’t correspond with their URLs.

All user-created pages render with the same view: view/omeka/site/page/show.phtml (and view/omeka/site/page/content.phtml, which renders the actual user-provided content within each page). If you want to change pages so that ones at certain slugs do something different, you’d have to override that theme view and check $page->slug() to decide what to do. There’s no automatic system that loads different views for different user-created pages.

Thank you for your suggestions.

Using the slug to render different layout is a good option.
I can now change the layout of the user created page content from the content.phtml template, as you suggest.

However, I cannot define a template for items, item-set, etc.
I tried to add a template such as .phtml, show.phtml, and browse.phtml in omeka/site/item-set/, but it does not work.

I am reading the Omeka-s documentation:
https://omeka.org/s/docs/developer/themes/theme_modifications/

Can you share a specific example of an override you’re trying that’s not working, with the exact name of the file within the theme you’re trying to use? Item set show is a unique case because it doesn’t have its own view (it shares the item browse view), but other than they should work fine and in the way you’ve described.

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.