Customize Search Block
Permalink
I have a homepage that requires different CSS for the search block than the rest of the site. I copied the search folder and renamed it, I changed the getByHandle to reflect the different folder.
Then I get Fatal error: Call to undefined method stdClass::render()
Any help would be appreciated.
<?php $bt_search = BlockType::getByHandle('search'); $bt_search->controller->resultsURL = '/search-results'; $bt_search->render('view'); ?>
Then I get Fatal error: Call to undefined method stdClass::render()
Any help would be appreciated.
Code correction, the code is:
If you actually need to change ONLY the CSS, then why not just edit the style sheet? If in fact you do need to customize the mark-up, then you should probably create a custom template. See here...
http://www.concrete5.org/documentation/general-topics/custom-templa...
http://www.concrete5.org/community/forums/customizing_c5/contributi...
-Steve
http://www.concrete5.org/documentation/general-topics/custom-templa...
http://www.concrete5.org/community/forums/customizing_c5/contributi...
-Steve
But I need a different CSS between the homepage and the interior pages. I have the interior working fine using the default search block.
In your header, assign an id to the body like:
<body id="<?php echo $c->getCollectionTypeHandle() ?>">.
This will result in <body id="home"> for the home page. You can then set up the styles in your css for #home. For example:
#home { background-image: url(../images/home_bg.jpg); background-repeat: repeat-x; }
Anyway, that's one way to do it.
<body id="<?php echo $c->getCollectionTypeHandle() ?>">.
This will result in <body id="home"> for the home page. You can then set up the styles in your css for #home. For example:
#home { background-image: url(../images/home_bg.jpg); background-repeat: repeat-x; }
Anyway, that's one way to do it.
That is not a bad idea, can't believe I didn't think about just changing elements in the CSS. I'll give that a try.
What I ended up doing is removing the styles from the CSS and placing them on the individual page types, worked great.