Position Of Breadrumbs In Layout

Basically I want to render my markup as follows:




<begin column 1>		<begin column 2>


H1 TAG				PORTLET WIDGET


BREADCRUMBS			<end column 2>	


PAGE CONTENT


<end column 1>



I’m having trouble achieving this because the breadcrumbs need to go below the H1, but the layout file needs to render $content and breadcrumbs widget separately. So the breadcrumbs can either appear before or after the page content. I know I can work around this by inserting the breadcrumbs widget within the view file instead of the layout file, but that means I would need to do this for every view file I have.

The H1 tag by the way is defined in the view files. I’m thinking perhaps if the H1 tag was moved to the layout file then I can position the breadcrumbs below it. But I couldn’t work out how to pass a variable to the layout file.

Anybody got any idea how I can go about this?

you may remove rendering of bradcrumbs from layout file and place it in every view wherever you want.

You may also modify layouts to render <h1> tag (based on controllers title attribute) and breadcrumbs, and remove <h1> tags from your views.

Dear GSTAR

If you are not averse in using javascript, we can register a script in main layout.




Yii::app()->clientScript->registerScript('crestFallenCrumbs','

$("#content h1:first").detach().insertBefore(".breadcrumbs");

');



Regards.

OK, I got it working, this is how:

  1. Created a public property $h1title in my controller

  2. Set the property value in my view file

  3. Render the property in my layout file as $this->h1title before the breadcrumbs widget code and $content variable

All sorted.