external url

How can I create an external url with Yii?

I used


<?php echo CHtml::link($comment['link_text'],CHtml::normalizeUrl($comment['link_url'])); ?>

but the url is related with my site.

For the url is http://yiiframework.com and the created url is http://mysite/mycontroller/http://yiiframework.com




<a href="<?php echo CHtml::normalizeUrl('/') . $comment['link_url']; ?>"><?php echo $comment['link_text']; ?></a>



but not sure, I can hardly understand your question. Hope that helps a bit.

I solved it.

Thank you

Wow, thanks for sharing your solution so when someone else has the same problem… blank stare

lol


edit, now that I found what works…

I’ll admit, that “my error” was a typo, an extra ‘)’ at the end of my line but here is what worked for me. I’d hate someone else to spin cycles like I did without a simple to provide concrete example.

<?php

echo CHtml::link(‘Yii Framework Website’, “http://www.yiiframework.com”);

?>

Thanks!

hi friend you can also create an external url by clicking on a image here is my code and its work fine

&lt;?php echo CHtml::link( CHtml::image(Yii::app()-&gt;request-&gt;baseUrl . '/images/android.png'),('www.google.com'), array('class'=&gt;&quot; &quot;)); ?&gt;

and in class option you can provide any css claas for an image

:blink: