Question about pages and blocks (I need a shortcut!)
Permalink 1 user found helpful
A client has asked me to add a formatted autonav breadcrumb and a graphic horizontal line to the top of every page of a catalog on his site. Being a client, he asked me to do this after I had initially recommended it, he rejected it, and I had built out the 150 pages. Now he sees why and wants it. Familiar?
Is there any way of making the process shorter than editing each page, adding two disparate items from the scrapbook, moving them to the top of the page, and then saving each of the pages??
Any advise will be very much appreciated.
Is there any way of making the process shorter than editing each page, adding two disparate items from the scrapbook, moving them to the top of the page, and then saving each of the pages??
Any advise will be very much appreciated.
I knew about page types, but I didn't know about apply on child pages - that's awesome.
Thanks
Thanks
i normally hardcode stuff like this to the pagetype. you can do that with a global block pretty easily
I considered that, but in this case I have used the page type for more than one kind of page layout and some pages didn't include the breadcrumb. In this case Mnkras's solution was perfect, and frankly I hadn't seen the function so i was glad to learn about it. I haven't hardcoded a block in however either. Is there a thread or page that might give me an overview of the method?
here's a couple of quick examples...
Hardcoding a global block to a page:
And the standard way to hardcode a block that's not in the scrapbook:
Hardcoding a global block to a page:
$block = Block::getByName('MailingListBox'); if( is_object($block) ) $block->display();
And the standard way to hardcode a block that's not in the scrapbook:
$bt = BlockType::getByHandle('autonav'); $bt->controller->displayPages = 'top_level'; $bt->controller->orderBy = 'display_asc'; $bt->controller->displaySubPages = 'none'; $bt->controller->displaySubPageLevels = 'custom'; $bt->controller->displaySubPageLevelsNum = '1'; $bt->render('view'); //$bt->render('templates/inneroptics_header');
Ta da!