Checkboxs for URLs

6 posts by 2 authors in: Forums > CMS Builder
Last Post: January 21, 2009   (RSS)

I have a multiple listing used for a "Quick Links" area.
I have 2 check boxes for each listing ... one to open in a different window and one to change the link to a CSS style for the text.
i need an IF/ELSE statement for each link that will allow those check box items to be applied.

Current Code
<td height="20"><a href="<?php echo $quicklinksRecord['url'] ?>" class="style4"><?php echo $quicklinksRecord['title'] ?></a></td>

I need a target="_blank" for the checkbox status "1" for the field named 'new_window'

I need class="style4blue" for the checkbox status "1" for the field named 'blue_link'

Could you provide me with the proper IF/ELSE statements for this?

Thanks,
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

Re: [justritedesign] Checkboxs for URLs

By Dave - January 20, 2009

Hi Michael,

Try this:

<?php if ($quicklinksRecord['new_window']): ?>target="_blank"<?php endif ?>

<?php if ($quicklinksRecord['blue_link']): ?>class="style4blue"<?php endif ?>

Just put those where you want them to appear.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Checkboxs for URLs

Can you have an ELSE statement inside those because what I see happening is that I need to call the class at the link but if I just use the code you have, it will end up rendering html that looks like :

...class="style4"class="style4blue ...

What I want it to do is:
If the checkbox is checked then input "class=style4blue" else use class="style4"

How would that look like?

I hope that makes more sense.

Thanks,
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

Re: [justritedesign] Checkboxs for URLs

By Dave - January 20, 2009

Try this:

<?php if ($quicklinksRecord['blue_link']): ?>
class="style4blue"
<?php else: ?>
class="style4"
<?php endif ?>
Dave Edis - Senior Developer
interactivetools.com

Re: [justritedesign] Checkboxs for URLs

Thanks Dave,

That is exactly what I was looking for.

Since this was inside a link I was forced to remove all the whitespace in the code.
But that code does perfectly.

Thanks again,
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"