Child pages
  • Changes in version 1.5 which impact theme development

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
{if isset($groups)}
	<!-- attributes -->
	<div id="attributes">
	{foreach from=$groups key=id_attribute_group item=group}
	{if $group.attributes|@count}
	<p>
		<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
		{assign var="groupName" value="group_$id_attribute_group"}
		<select name="{$groupName}" id="group_{$id_attribute_group|intval}" onchange="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">
			{foreach from=$group.attributes key=id_attribute item=group_attribute}
				<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
			{/foreach}
		</select>
	</p>
	{/if}
	{/foreach}
	</div>
{/if}

In 151.5:

Code Block
{if isset($groups)}
	<!-- attributes -->
	<div id="attributes">
	{foreach from=$groups key=id_attribute_group item=group}
		{if $group.attributes|@count}
			<fieldset class="attribute_fieldset">
				<label class="attribute_label" for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
				{assign var="groupName" value="group_$id_attribute_group"}
				<div class="attribute_list">
				{if ($group.group_type == 'select')}
					<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="attribute_select" onchange="findCombination();getProductAttribute();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">
						{foreach from=$group.attributes key=id_attribute item=group_attribute}
							<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
						{/foreach}
					</select>
				{elseif ($group.group_type == 'color')}
					<ul id="color_to_pick_list" class="clearfix">
						{assign var="default_colorpicker" value=""}
						{foreach from=$group.attributes key=id_attribute item=group_attribute}
						<li>
							<a id="color_{$id_attribute|intval}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}" style="background: {$colors.$id_attribute.value};" title="{$colors.$id_attribute.name}" onclick="colorPickerClick(this);getProductAttribute();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if}">
								{if file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
									<img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$colors.$id_attribute.name}" width="20" height="20" /><br>
								{/if}
							</a>
						</li>
						{if ($group.default == $id_attribute)}
							{$default_colorpicker = $id_attribute}
						{/if}
						{/foreach}
					</ul>
					<input type="hidden" id="color_pick_hidden" name="{$groupName}" value="{$default_colorpicker}" />
				{elseif ($group.group_type == 'radio')}
					{foreach from=$group.attributes key=id_attribute item=group_attribute}
						<input type="radio" class="attribute_radio" name="{$groupName}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} onclick="findCombination();getProductAttribute();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if}">
						{$group_attribute|escape:'htmlall':'UTF-8'}<br/>
					{/foreach}
				{/if}
				</div>
			</fieldset>
		{/if}
	{/foreach}
	</div>
{/if}

...

The file layout.tpl should be taken into account.

This file is defined (by default) as follows:

  • Include header.tpl file (if we display the contents)
  • Include the desired template file
  • Include footer.tpl file (if we display the contents)
  • Include "Live Edit"

You can modify the contents of this file based on an entity type or entity itself.

Type of entity

When you want to change the layout as an entity type such as categories, you can define a file layout-EntityType.tpl defined as follows:

Code Block
{if !empty($display_header)}
    {include file='../header.tpl' HOOK_HEADER=$HOOK_HEADER}
{/if}
{* Your template start here *}
{if !empty($display_footer)}
    {include file='../footer.tpl'}
{/if}
{if !empty($live_edit)}
    {$live_edit}
{/if}

This file will be placed in: /themes/default/override/layout-category.tpl (For the category entity )

N.B.: a controller is an entity type. This means that you can use this feature for the supplier, stores, product, category, and many others entities.

By entity

When you want to change the layout according to a particular entity (e.g. for the product entity with ID 1) you can define a file-layout-EntityType-ID.tpl defined as:

Code Block
{if !empty($display_header)}
    {include file='../header.tpl' HOOK_HEADER=$HOOK_HEADER}
{/if}
{* Your template start here *}
{if !empty($display_footer)}
    {include file='../footer.tpl'}
{/if}
{if !empty($live_edit)}
    {$live_edit}
{/if}

This file will be placed in: /themes/default/override/layout-product-1.tpl (For the product entity with ID 1)

Dynamic template

It's possible to override the getOverrideTemplate from a FrontController to dynamically change the template.

General considerations theme URLs and form action

...