[solved] {cms_breadcrumbs} giving some headace

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
zigge
Forum Members
Forum Members
Posts: 75
Joined: Tue Jan 22, 2008 6:53 pm

[solved] {cms_breadcrumbs} giving some headace

Post 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
Last edited by zigge on Tue Jul 31, 2012 9:23 am, edited 1 time in total.
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: {cms_breadcrumbs} giving some headace

Post by Jos »

{if $page_alias="home"} should be {if $page_alias=="home"} perhaps?
zigge
Forum Members
Forum Members
Posts: 75
Joined: Tue Jan 22, 2008 6:53 pm

Re: {cms_breadcrumbs} giving some headace

Post 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.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [solved] {cms_breadcrumbs} giving some headace

Post by Dr.CSS »

Maybe reading it again might help?... ;)

http://www.smarty.net/docsv2/en/languag ... ion.if.tpl
zigge
Forum Members
Forum Members
Posts: 75
Joined: Tue Jan 22, 2008 6:53 pm

Re: [solved] {cms_breadcrumbs} giving some headace

Post 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.... :)
carasmo
Power Poster
Power Poster
Posts: 506
Joined: Thu Feb 08, 2007 6:11 pm

Re: [solved] {cms_breadcrumbs} giving some headace

Post 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.
Post Reply

Return to “CMSMS Core”