I have an if statement that is at the end of a for each loop that adds the | character at the end of a generated unordered list.
My goal is to add | after "not the last two".
<?php if (! $_link->getIsLast()):?>|<?php endif;?>
I was hoping I could input a value in the getIsLast or getIsFirst functions like this:
<?php if (! $_link->getIsLast(2)):?>|<?php endif;?>
I was hoping the above statement would add the | character for each generated list item except for the last two. However, it doesn't seem to be working.
Does anyone know the proper syntax to do something like this?
The for each loops is below:
<ul class="links pull-right"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php foreach($_links as $_link): ?>
<?php if ($_link instanceof Mage_Core_Block_Abstract):?>
<?php echo $_link->toHtml() ?>
<?php else: ?>
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>
<?php endif;?>
<?php if (! $_link->getIsLast()):?>|<?php endif;?>
<?php endforeach; ?>
</ul>
|only for itemsm..nwheremis some starting index andnis an ending index of the list?|?echo "|";does the same crap.