Try:

<?php if (!empty($user['social_media']['linkedin'])):?>

<td valign="bottom" align="center">

        <?php echo $html->link($html->image('linkedin.gif', array ('alt' =>
'LinkedIn' , 'align' => 'bottom')), "{$user['social_media']
['linkedin']}", array(), null, false); ?>
        <?php echo $user['social_media']['linkedin']; ?>

</td>

<?php endif; ?>

Essentially store the value you wish to act as a URL in a variable and
call that variable. Also remember PHP treats single quotes as strings,
and will not search for variables inside them; whereas it will do so
in double quotes. If it's an array you're calling in double quotes,
remember to use curly brackets around it.


On 1 June, 20:27, bobbiloo <b...@liu.com> wrote:
> In this example:
>
> <?php if (!empty($user['social_media']['linkedin'])):?>
> <td valign="bottom" align="center">
> <?php echo $html->link($html->image('linkedin.gif', array ('alt' =>
> 'LinkedIn' , 'align' => 'bottom')), ' ', array(), null, false); ?>
> <?php echo $user['social_media']['linkedin']; ?></td>
> <?php endif; ?>
>
> I am trying to use a field in my social_media table, entitled
> "linkedin," to be the url of my $html->link statement. But if I plug
> that php echo line in between the single quotes, I get a parse
> error.
>
> How can I retrieve this table field to be the URL in my $html->link
> statement?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to