0
votes

My web site layout has images to the right of most pages. I want to configure which image to show in the menu item settings.

It seems that the proper place to configure the image would be the page display options for the menu item. I don't want to use the Page Class option as this would require changing the template for every new image.

Is there a way I can add a custom Page Display Option (for the image url) and read that from the template?

1
Are you asking about in a core component or in something you have written? If it's something you have written just put a media field in your default.xml and you can select an image. Then the image will be in your parameters and you just echo it out in the layout. - Elin
I'm creating a custom template, but everything else is standard. So I want to somehow pass an option from the menu item configuration to the template and use that to find and display the image - Alex R
A template in the sense of a layout in the veiw/tmpl folder? Whatever you put in a field listed in the xml is accessible to the layout. Are y talking about something inside an article? - Elin
I want to define something on the page level, neither in the article (which was my first approach) nor on the complete template. I'm new trying the CustomHeader module which should do what I need if I can just get it to run. Thanks for the help - Alex R
SOunds like a module to me. - Elin

1 Answers

0
votes

I'm assuming that the image is being displayed in a module. If so, there are a few ways to do it -

  1. Use the menu assignment to turn the module on or off per page you want it to display. This would require a module per different image.

  2. Make the image a background in the module, then using the page class suffix, change which image is used as the background using CSS. This would require one line of CSS per image you want to use.

  3. You could also write a custom module or a module override that uses the page class suffix to create a dynamic URL for the SRC of the image.