Add field to $mainnav array

Add field to $mainnav array, a forum discussion on Jojo CMS. Join us for more discussions on Add field to $mainnav array on our Administration (backend and configuration) forum.

Back to Forum Index : Back to Administration (backend and configuration)   RSS
pa0l0

25 May 2010
Posts: 3

Hello,

I'm new user of Jojo and I really enjoy it :).

On my site I want to create custom pages menu. Each page will have assigned menu image that will be displayed in menu. To do this I have added field to pages table. I would like to add this field also to $mainnav array. How to do this?

this is my menu code:
{foreach from=$mainnav item=n}
<a href="{$n.url}">
<img alt="{$n.label}" src="img/{$n.pg_menuimage}" />
</a>
{/foreach}

So how to add pg_menuimage to $mainnav array?
Jaijaz Jaijaz

26 May 2010
Posts: 215

So there are two ways I have done this in the past. The first and easiest way, though also the easiest one to brake is to use this code:

{foreach from=$mainnav item=n}
<li>
<a href="{$n.url}" title="{$n.title|escape:"html"}"{if $n.pg_followto=='no'} rel="nofollow"{/if}>
<img src="../images/btn-{$n.pg_menutitle|lower|replace:' ':'-'}{if in_array($n.pageid, $selectedpages)}-selected{/if}.gif" /></a>
</li>
{/foreach}

Basically I have just put the menu images into the images folder of the theme with a specified naming convention. Unfortunately the user can't add pages with new images easily.

Alternately I have attached a zip file of a template.tpl and global.php file from a site where I have copied the standard mainnav function and modified it. Generating an array called $topnav

Now that I think about it I have also just used sIFR as well when all the design wanted was an out there font.

Hope one of those helps.
If you not living on the edge you taking up too much space.
Jaijaz Jaijaz

26 May 2010
Posts: 215

Opps attached the file as an image, here it is.

Attached Files

If you not living on the edge you taking up too much space.
pa0l0

27 May 2010
Posts: 3

I used sollution from Archive.zip. It works fine. Thank You.
Back to Forum Index : Back to Administration (backend and configuration)   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.