Welcome Guest, Not a member yet? Register   Sign In
<solved> Creating a html link from text field
#1

[eluser]fs_xyz[/eluser]
Hi all,

I guess this will be my next.. stupid question. >.<
Still new here.

I wonder how to make a html link from a text field.
Uhh, I input html link to database in text field. Like this :

someword
<a href="somelink.com"> link </a>
someword

If I view this text field just by display it normally it will create a normal link.
Well, the word link with underscore right under it.

someword
link
someword

Problem is, when I click on the word link, it end up leading not to http://something.com but rather to : http://my_ci_app/something.com

This of course won't take you to http://something.com. Is there a way to solve this ?
Uhh, I used form validation with rule trim for the text field.

Also the next problem is, if I end up full view the post where the link is, the http change again into : http://my_ci_app/index.php/my_controller/something.com

For easier imagination... imagine I'm trying to create a blog, inside that blog there is a post with html link in it. The html link change when you view it from preview and from detail view.
#2

[eluser]Ben Edmunds[/eluser]
Are you using the anchor() function or an A tag? The anchor function will create the link for your site based on your base_url.
#3

[eluser]fs_xyz[/eluser]
I used "A" tag since the link is part of a text.
Imagine it like a text when you are posting for blog or posting a comment into somebody else blog or post.
Or easier, my 1st post. I created a link with that link word, right ? ( I don't think I will need to use anchor for that )

Problem is how the link end up leading to different address rather the address I want.

If I use
Code:
<a href="www.google.com"> link </a>
When I hover over the link, it won't show www.google.com but rather http://my_ci_app/index.php/www.google.com.

The link reside inside a database text field. Not the one we used as navigation or the like which the anchor command work wonder.
#4

[eluser]Colin Williams[/eluser]
The link needs http:// in it. What you are seeing is 100% normal behavior
#5

[eluser]fs_xyz[/eluser]
I see, thank you... got used without including http://.
One more problem solved.




Theme © iAndrew 2016 - Forum software by © MyBB