using "url" field name to pop new page

5 posts by 2 authors in: Forums > CMS Builder
Last Post: July 12, 2010   (RSS)

By drewh01 - July 9, 2010

I am using the "url" fieldname to override a nav link for CMSB, how can I get it to pop into a new window rather than the current window?

This is the code I am using:

<?php if ($categoryRecord['url']) { $categoryRecord['_link'] = $categoryRecord['url']; } ?>

Re: [drewh01] using "url" field name to pop new page

By Jason - July 12, 2010

Hi,

All you need to do is to get the target attribute in your <a> tag.

For example:
<a href="<?php echo $categoryRecord['_link'];?>" target="_blank"><?php echo $categoryRecord['name'];?></a>

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [drewh01] using "url" field name to pop new page

By Jason - July 12, 2010

Hi,

Try this (I've highlighted the change in red):

<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php if ($categoryRecord['url']) { $categoryRecord['_link'] = $categoryRecord['url']; } ?>
<?php echo $categoryRecord['_listItemStart'] ?>
<?php if ($categoryRecord['_isSelected']): ?>

<a href="<?php echo $categoryRecord['_link'] ?>" <?php if($categoryRecord['url']){echo "target='_blank'";};?>><?php echo $categoryRecord['name'] ?></a>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>" <?php if($categoryRecord['url']){echo "target='_blank'";};?>><?php echo $categoryRecord['name'] ?></a>
<?php endif; ?>
<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach; ?>


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] using "url" field name to pop new page

By drewh01 - July 12, 2010

awesome - thanks!