i have a php elseif code that looks like that,
<?php if ($item->getPrimaryImage()) :?>
<img src="<?php echo $item->getPrimaryImage()->getSource(); ?>" class="sprocket-lists-image" alt="" />
<?php endif; ?>
<?php echo $item->getText(); ?>
<?php if ($item->getPrimaryLink()) : ?></br>
<?php if ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1d3vCj3") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php elseif ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1K7W323") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php elseif ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1d3vBLZ") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php elseif ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1K7W4Dh") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php elseif ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1d3vBM1") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php elseif ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1K7W4Tv") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php elseif ($item->getPrimaryLink()->getUrl() == "http://ift.tt/1d3vBM4") : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php else : ?></br>
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="modal" rel="{size: {x: 1024, y: 550}, handler:'iframe'}"><span><?php rc_e('READ_MORE'); ?></span></a>
<?php endif; ?>
<?php endif; ?>
the code is quite simple , that is
-
all the elseif have a link starting like == "index.php... etc,,, meaning that the readon button will open inside the website like _parent link WITHOUT the MODAL..
-
the last (case) else open all the rest links INSIDE THE MODAL
Question
You will notice that all the links on the elseif cases starting like "index.php/..,,, Is there is any way of coding to avoid all the elseif and having something global, meaning that will recognize the starting link "index.php/.. ? You will notice that the action followed for the elseif
<a href="<?php echo $item->getPrimaryLink()->getUrl(); ?>" class="readon"><span><?php rc_e('READ_MORE'); ?></span></a>
on all the cases is the same.
I need a piece of code that will understand-recognize the link starting "index.php/.. is this possible ?
Target
My target is that i do not want to use so many elseif every time a new link have to be added, and the code will take care it,, cause right now every time when i have to add a new image-banner that will link to an article inside the joomla site i have to hardcoded and add a new elseif like the above,,, otherwise it will open it inside the modal..
I hope its clear enough, please some help cause i m trying for ages to solve this..
Thank you in advance for reading this..
Aucun commentaire:
Enregistrer un commentaire