Yii Framework Forum: external url - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

external url Rate Topic: -----

#1 User is offline   dimis283 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 277
  • Joined: 24-January 09

Posted 02 August 2010 - 03:25 PM

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/mycont...iiframework.com
Posted Image
0

#2 User is offline   yiimann 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 19-December 09

Posted 02 August 2010 - 03:59 PM

<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.
0

#3 User is offline   dimis283 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 277
  • Joined: 24-January 09

Posted 02 August 2010 - 04:10 PM

I solved it.
Thank you
Posted Image
0

#4 User is offline   MichaelG 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 19-October 10
  • Location:Roseville, CA

Posted 31 October 2010 - 06:41 PM

View Postdimis283, on 02 August 2010 - 04:10 PM, said:

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");
?>
0

#5 User is offline   Vert 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 02-March 12

Posted 21 March 2012 - 11:55 AM

Thanks!
0

#6 User is offline   rajesh chaurasia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 12-January 13
  • Location:Mohali

Posted 20 March 2013 - 05:21 AM

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
:blink:
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users