Pagelist Open Link in New Window when External link
Permalink
Hello!!
I made a code for a page list with pages on de website and External links. I want the external links opened in a new tab when checked. But it doesn't. Can somebody take a look at my code and say how I can make the link check if it's a external link?
I found this link but this doesn't work (https://www.concrete5.org/community/forums/customizing_c5/external-links-with-open-link-in-new-window-not-opening-in-new-t/#925131)
Much thanks
I made a code for a page list with pages on de website and External links. I want the external links opened in a new tab when checked. But it doesn't. Can somebody take a look at my code and say how I can make the link check if it's a external link?
I found this link but this doesn't work (https://www.concrete5.org/community/forums/customizing_c5/external-links-with-open-link-in-new-window-not-opening-in-new-t/#925131)
Much thanks
<?php if(!defined('C5_EXECUTE')) die('Access denied'); $ih = Core::make('helper/image'); $th = Loader::helper('text'); $page = Page::getCurrentPage(); ?> <?php foreach($pages as $page) { ?> <div class="news__item"> <a href="<?php echo $page->getCollectionLink(); ?>"></a> <div class="news__photo"> <?php if($image = $page->getAttribute('news_photo')) { ?> <figure class="figure" style="background-image: url(<?php echo $ih->getThumbnail($image, 900, 600, true)->src; ?>)" alt="<?php echo $image->getDescription(); ?>" title="<?php echo $image->getDescription(); ?>"></figure> <?php } ?> </div>
Viewing 15 lines of 23 lines. View entire code block.
Here you go - this should work:
Viewing 15 lines of 27 lines. View entire code block.
Thank you so much!!
</a> was in the wrong place for my block but fixed it!
</a> was in the wrong place for my block but fixed it!
Great - glad it worked.
Sorry I moved the </a> - I had presumed it was empty by mistake.
=0)
Sorry I moved the </a> - I had presumed it was empty by mistake.
=0)