Forums / Developer / Matching up class and current object class [SOLVED]

Matching up class and current object class [SOLVED]

Author Message

Lo' F.

Monday 11 October 2010 5:05:34 am

Hello again!

I need to insert a condition to a script block in pagelayout.tpl so that the script runs only if the class of the pages' main area is a gallery.

{if ...|eq(..)}
  {literal}
  <script type="text/javascript" language="javascript">
    ...
  </script>
  {/literal}
{/if}

How can I compare the two?

loredanaebook.it

Lo' F.

Monday 11 October 2010 5:57:04 am

I maybe got the actual class name to match..

{def $class=fetch('content', 'class', hash('class_id', 35))}
{if ...|eq($class.name)}
...

yet missing the current one..

loredanaebook.it

Lo' F.

Monday 11 October 2010 12:54:50 pm

..and got it!

{def $class=fetch('content', 'class', hash('class_id', 35))}
{if $module_result[content_info][class_id]|eq($class.id)}
{literal}
<script type="text/javascript">
   ...
</script>
{/literal}
{/if}

Used id instead of name since the latter returned the name of the class one with the first letter in capital and the other not.. so chose this way as a shortcut..

loredanaebook.it