Author Topic

Pål Messenlien

Thursday 24 November 2005 3:30:01 pm

Comment40957

I know this is a old post. But it helped me getting what i wanted. I used the code Rinze posted, thanks alot! The reason im replying is that i found the reason for the description bug. When your checking code from the start page for example. You got a meta tagged that looked like this

meta name="description" content="Object(ezxmltext)"

The reason for this is that your standing in a folder, and default the folder class got a xml field called description. The workaround i found is to just use another name for the description field. I also had to use $node instead of $current_node, might be because im using a 3.6.* site? Anyway the working code for my page_head.tpl looks like this.

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{*?template charset=latin1?*}
{default enable_help=true() enable_link=true()}

{let name=Path
     path=$module_result.path
     reverse_path=array()}
  {section show=is_set($module_result.title_path)}
    {set path=$module_result.title_path}
  {/section}
  {section loop=$:path}
    {set reverse_path=$:reverse_path|array_prepend($:item)}
  {/section}

{set-block scope=root variable=site_title}
{section loop=$Path:reverse_path}{$:item.text|wash}{delimiter} / {/delimiter}{/section} - {$site.title|wash}
{/set-block}

{/let}

    <title>{$site_title}</title>

    {section show=and(is_set($#Header:extra_data),is_array($#Header:extra_data))}
      {section name=ExtraData loop=$#Header:extra_data}
      {$:item}
      {/section}
    {/section}

    {* check if we need a http-equiv refresh *}
    {section show=$site.redirect}
    <meta http-equiv="Refresh" content="{$site.redirect.timer}; URL={$site.redirect.location}" />

    {/section}

    {section name=HTTP loop=$site.http_equiv}
    <meta http-equiv="{$HTTP:key|wash}" content="{$HTTP:item|wash}" />

    {/section}

    {section name=meta loop=$site.meta}
{switch match=$meta:key|wash}

{case match=description}
{section show=is_set($node.data_map.ndescription)}
{section show=ne($node.data_map.ndescription.content, "")}
<meta name="{$meta:key|wash}" content="{$node.data_map.ndescription.content}"/>

{section-else}
<meta name="{$meta:key|wash}" content="{$meta:item|wash}"/>

{/section}
{section-else}
<meta name="{$meta:key|wash}" content="{$meta:item|wash}"/>

{/section}
{/case}
{case match=keywords}
{section show=is_set($node.data_map.keywords)}
{section show=ne($node.data_map.keywords.content, "")}
<meta name="{$meta:key|wash}" content="{$node.data_map.keywords.content}"/>

{section-else}
<meta name="{$meta:key|wash}" content="{$meta:item|wash}"/>

{/section}
{section-else}
<meta name="{$meta:key|wash}" content="{$meta:item|wash}"/>

{/section}
{/case}

{case}
<meta name="{$meta:key|wash}" content="{$meta:item|wash}"/>

{/case}
{/switch}
{/section}

    <meta name="MSSmartTagsPreventParsing" content="TRUE" />
    <meta name="generator" content="Exponential" />

{section show=$enable_link}
    {include uri="design:link.tpl" enable_help=$enable_help enable_link=$enable_link}
{/section}

{/default}

Hope its usefull for someone.

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------