dimis283
(Dimis283)
August 2, 2010, 8:25pm
1
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
yiimann
(Contact)
August 2, 2010, 8:59pm
2
<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.
MichaelG
(Aceandember)
October 31, 2010, 11:41pm
4
dimis283:
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 ”);
?>
hi friend you can also create an external url by clicking on a image here is my code and its work fine
<?php echo CHtml::link( CHtml::image(Yii::app()->request->baseUrl . '/images/android.png'),('www.google.com'), array('class'=>" ")); ?>
and in class option you can provide any css claas for an image