[SOLVED] How to adjust image location on menu.tpl

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
User avatar
fearmydesign
Power Poster
Power Poster
Posts: 363
Joined: Sun Feb 28, 2010 10:54 pm

[SOLVED] How to adjust image location on menu.tpl

Post by fearmydesign »

Hi, so I am able to get my Options image to show for my menu items... but how do I make the image show above the actual menu text? Here is my cssmenu template code with my $node->image. It's version 1.11 and my loadprops is set to ="1". You can view the progress here: http://whirlzyogurtbar.com/index.php

Code: Select all

{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}

{assign var='number_of_levels' value=10000}
{if isset($menuparams.number_of_levels)}
  {assign var='number_of_levels' value=$menuparams.number_of_levels}
{/if}

{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="unli">' times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string='</li></ul>' times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}

{if $node->parent == true or $node->current == true}
  {assign var='classes' value='menuactive'}
  {if $node->parent == true}
    {assign var='classes' value='menuactive menuparent'}
  {/if}
  {if $node->children_exist == true and $node->depth < $number_of_levels}
    {assign var='classes' value=$classes|cat:' parent'}
  {/if}

  <li class="{$classes}"><a class="{$classes}" 
{elseif $node->type == 'sectionheader' and $node->haschildren == true}
  <li class="menuparent"><a class="menuparent"><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'sectionheader'}
  <li><a ><span class="sectionheader">{$node->menutext}</span></a>
{elseif $node->type == 'separator'}
  <li style="list-style-type: none;"> <hr class="menu_separator" />
{elseif $node->children_exist == true and $node->depth < $number_of_levels and $node->type != 'sectionheader' and $node->type != 'separator'}
  <li class="menuparent"><a class="menuparent" 
{else}
  <li>
  <a 
{/if}


{if ($node->type != 'sectionheader' and $node->type != 'separator') or $node->parent == true or $node->current == true }
 {if $node->target}target="{$node->target}" {/if}
href="{$node->url}"><span>{$node->menutext}</span>{if isset($node->image) && $node->image != ''}&nbsp;&nbsp;<img src="{$node->image}" alt="" />{/if}</a>
{/if}
{/foreach}
{repeat string='</li></ul>' times=$node->depth-1}
</li>
</ul>
<div class="clearb"></div>
</div>
{/if}
This is the line of code displayin the menu image:

Code: Select all

{if isset($node->image) && $node->image != ''}&nbsp;&nbsp;<img src="{$node->image}" alt="" />{/if}
Last edited by fearmydesign on Sat Aug 11, 2012 12:04 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How to adjust image location on menu.tpl

Post by Dr.CSS »

Most likely, if you want it above, you may need to make some CSS changes...

This would be the quickest way...

{if isset($node->image) && $node->image != ''}<img src="{$node->image}" alt="" /><br />{/if}<span>{$node->menutext}</span>
User avatar
fearmydesign
Power Poster
Power Poster
Posts: 363
Joined: Sun Feb 28, 2010 10:54 pm

Re: How to adjust image location on menu.tpl

Post by fearmydesign »

Dr.CSS wrote:Most likely, if you want it above, you may need to make some CSS changes...

This would be the quickest way...

{if isset($node->image) && $node->image != ''}<img src="{$node->image}" alt="" /><br />{/if}<span>{$node->menutext}</span>
Thank you, that worked!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [SOLVED] How to adjust image location on menu.tpl

Post by Dr.CSS »

Is about the same as I did for http://dequenesh.org/ except I made them change on hover...
Post Reply

Return to “Layout and Design (CSS & HTML)”