Widget as Header?

Greetings.

As I’m getting to know Preside, I’ve discovered the magic of creating and configuring navigational menus. Works great.

However, I have a header configured as a widget which I’m including on every sub page. See red bar w/ menu below:

And this is how I’m including the widget on sub pages:

I must be doing something wrong because I would expect to only have to edit the sub page by itself instead of having to insert the header as well.

What should I be doing?

can you paste the code of the page-type view?
basically you can do all this stuff automatically without the widget. But well, there are several ways to solve this.

This is views/page-types/standard_page/index.cfm.

Long time ago, that I’ve seen such a small template :wink:

What I would do here is:

<cfoutput>
#renderviewlet(event="myhandler,menufuction")#

#args.main_content#
</cfoutput>

with your own handler you can automatically generate the proper navigation and don’t need the widget on every page.
I guess you can reuse the widget code you already did. Means: renderviewlet(event="widgets.mynavigation") maybe already works.

Ok, I’ll give that a try.

So adding the code you suggested to views/page-types/standard_page/index.cfm will somehow make the menu automatically show at the top of every page? I don’t understand how that works.

This is basically the logic of the underlying coldbox framework. You can “include” stuff via renderview or renderviewlet and make life easy for you.

For example, this is my page-types/homepage/index.cfm:

<cfscript>
	vSlider         = renderViewlet(event="homepage.slider");
	vTopNews        = renderViewlet(event="homepage.topNews");
	vStudien        = renderViewlet(event="homepage.studien");
	vPM             = renderViewlet(event="homepage.pm");
	vLatestArticles = renderViewlet(event="artikel.showLatestArticles");
</cfscript>

<cfoutput>
	<div class="container-fluid m-0 p-0">
		<div class="container p-0 position-relative">
			#vSlider#
		</div>
	</div>

	<div class="container h-100 p-0">
		<div class="row">
			<div class="col-12 col-md">
				#renderViewlet(event="advertising",args={location=57,class="px-0"})#
				#renderViewlet(event="advertising",args={location=90,class="px-0"})#
			</div>
		</div>
		<div class="row">
			<div class="col-12 col-md">
				<main>
					#vStudien#
					#vPM#
					#renderViewlet(event="advertising",args={location=63,class="px-0"})#
					#vTopNews#
				</main>
			</div>
			<div class="col-12 sidebar p-0">
				<aside>
					#renderView(view="page/_rightColumn", args = args)#
				</aside>
			</div>
		</div>
	</div>

You see, I include a bunch of stuff like ads, banners, my right column, etc. with renderviewlet. The handler is doing the neccessary logic.