Page 1 of 1

[solved] {cms_breadcrumbs} giving some headace

Posted: Tue Jul 31, 2012 8:27 am
by zigge
Now, after upgrading to 1.11 and reinstalled the Menu Manager, I now can use the {cms_breadcrumbs} instead of the old {breadcrumbs}

However, the old tag presented the name of the start page even if it was not set as active in the menu, and this was preferable from my part. In the new {cms_breadcrumbs}, if the page was not set to active in the menu, no output woult come from this tag.

Easy fix I thought, just adding an If/else/endif in my page template, to validate the page alias, and either put a static text, or add the {cms_breadcrumbs}

Ohhhh man....after several hours dumping out variables and almost bashing the laptop to pieces I found something I can't explain.

First, this is my initial code:

Code: Select all

{if $page_alias="home"}
      You are here: <strong>Startsida</strong>
{else}
      {menu action='breadcrumbs'}
{/if}
Now this would give me the same breadcrumb text on whatever page that loads, namely the static text. Also, looking at the dumped variables, the $page_alias is always "home"!!!!

Changing to look at the $page_id now results in that the $page_id is always the same regardless of of page selected!!!

Tried $page, $page_name, $page_id and $page_alias. Same behavior!

Now to the spooky stuff....turning the condition around to....

Code: Select all

{if $page_alias!="home"}
      {menu action='breadcrumbs'}
{else}
      You are here: <strong>Startsida</strong>
{/if}
....and it works! And the dumped template variables are changing as the should when shifting pages.

Now, can you clever guy's tell me what is going on?

Mats

Re: {cms_breadcrumbs} giving some headace

Posted: Tue Jul 31, 2012 8:43 am
by Jos
{if $page_alias="home"} should be {if $page_alias=="home"} perhaps?

Re: {cms_breadcrumbs} giving some headace

Posted: Tue Jul 31, 2012 9:23 am
by zigge
Jos wrote:{if $page_alias="home"} should be {if $page_alias=="home"} perhaps?
Well, I now feel stupid... Yep, adding the == works. Simple stuff that so easily beeing overlooked.

Re: [solved] {cms_breadcrumbs} giving some headace

Posted: Tue Jul 31, 2012 9:59 pm
by Dr.CSS
Maybe reading it again might help?... ;)

http://www.smarty.net/docsv2/en/languag ... ion.if.tpl

Re: [solved] {cms_breadcrumbs} giving some headace

Posted: Wed Aug 01, 2012 6:42 am
by zigge
Dr.CSS wrote:Maybe reading it again might help?... ;)

http://www.smarty.net/docsv2/en/languag ... ion.if.tpl
yeah, yeah.....rub it in.... :)

Re: [solved] {cms_breadcrumbs} giving some headace

Posted: Wed Aug 01, 2012 9:52 pm
by carasmo

Code: Select all

{if $page_alias eq 'page-alias'}
"eq" is less confusing for me as is "not" and regular words which then when I go back I can follow what my idea was.