How to change layout used for Search results?

I copied the “ContentBox Goodness” out and used it to create a new layout for the app. I’ve been getting over small hurdles in “how to do it”, but overall, once you realize how, things are mighty easy!

Right now, though, I’m using a layout that doesn’t have the sidebar (that was cool, sidebar=false) and used the same feature style to remove the links at the bottom. However, I’ve got this great new “page layout”, I guess you’d call it, but I don’t see how to keep the Search form alive, but change its layout to use my new one that doesn’t have the other stuff.

Any ideas?

  • WB

Or maybe better yet, how to change the default layout for all new content groups and pages?

Ok, not understanding it Will, are you saying how to assign a layout to a page or hierarchy of pages

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

The problem with the search is that it works across content in the Database, blog content as well as pages I think. So the only way to change that would be to change the cfml pages for Blog and Page. As that is where the results will be displayed with their containers for look and feel.

Can you be more specific to what it is your trying to achieve?

Hey, thanks for the replies, guys.

There’s the global search widget in the top left of most of the templates. This posts to something like /_search. That results page, as best I can tell, is not listed in the CMS page list. (Makes sense.) But if you have, say, four or five different templates, and you want to use one of those on the search results page, I can’t find a way to set that. There’s no setting (that I’ve found) for “default template” or “Search Results Template: {dropdown}”.

What I had to do was modify the args.sideBar cfparam to default to false. However, that doesn’t seem like the right thing, because now I would have to create another quickLayout() call in a new template that always turned that sidebar on, if I wanted to use it.

Hahn ok I understand now.

Yes the search event uses the search view in your theme. So basically you need to skin the search view as it uses the pages layout by convention.

Any ideas on improvement

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano

Luis,

I guess the only suggestion would be to allow a setting somewhere to choose the layout associated with the search results page. Is that the only dynamic output page like that? That isn’t controlled by the CMS directly?

  • WB

Will, upon further investigation you can change the layout of the search rather easily but programmatically not via settings.

You can listen to the “cbui_onContentSearch” event and then use the setLayout method to change the layout.

event.setLayout(name="#prc.cbLayout#/layouts/WHATEVERLAYOUT", module=“contentbox”)

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Actually, this won’t work, sorry, as the handler sets it up after. one sec

Okay, I’ll give that a shot. I would still suggest a setting for future setups if possible.

It would also be nice to have the ability to change the default layout for the entire app based on a setting. I know some of that is “theme” dependent, but if there was a setting, it would make it easier to change a lot of pages over to a different template at one time, if they could start by defaulting to a setting indicating which layout to use.

Thanks Will, yes, please submit tickets for this.

I just updated a quick fix for this. So now the event fires after the original setting of the layout. So you can override with the event now:

component{

function cbui_onContentSearch(){
var prc = event.getCollection(private=true);

event.setLayout(name="#prc.cbLayout#/layouts/WHATEVERLAYOUT", module=“contentbox”);

}

}

Not sure how to “submit” tickets.

And by “updated” you mean, I would assume, in the Dev branch of the Git repo?

The bug reporting is in the welcome message: https://coldbox.assembla.com/spaces/contentbox/support/tickets

Yes, dev branch

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano