Jump to content

Display links with condition


Recommended Posts

Hi all,

The problem is primitive in fact, but I can't understand how to implement it.

There is a module that displays all the links in one list <ul> by this way:

 


<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
<li><a href="#">Link 5</a></li>
<li><a href="#">Link 6</a></li>
</ul>

 

I need to make several <ul> lists with 2 links. It must be smth like this:

 

<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
</ul>

<ul>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
</ul>

<ul>
<li><a href="#">Link 5</a></li>
<li><a href="#">Link 6</a></li>
</ul>

 

Here's the code of array

 

{foreach from=$cms_titles key=cms_key item=cms_title}
<div id="footer_menu">
<ul class="footer_navigation">
{foreach from=$cms_title.categories item=cms_page}
{if isset($cms_page.link)}
<li class="bullet"><b style="margin-left:2em;">
<a href="{$cms_page.link}" title="{$cms_page.name|escape:html:'UTF-8'}">{$cms_page.name|escape:html:'UTF-8'}</a>
</b></li>
{/if}
{/foreach}
{foreach from=$cms_title.cms item=cms_page}
{if isset($cms_page.link)}
<li><a href="{$cms_page.link}" title="{$cms_page.meta_title|escape:html:'UTF-8'}">{$cms_page.meta_title|escape:html:'UTF-8'}</a></li>
{/if}
{/foreach}
</ul>
</div>
{/foreach}

 

Thank you for your replies

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More