-
November 30th, 2009, 01:37 PM
#1
tinyMCE - Alter url
I´m using tinyMCE and when I send my text with an url this is what I get:
Code:
<p><a href=\"aaa\" target=\"_blank\">asdas</a></p>
How can I do to normalize it?
I´d like to get:
<p><a href='aaa' target='_blank'>asdas</a></p>
I´ve tried
Code:
$txt = str_replace("/\/","", $_POST['text']);
$txt = str_replace('"',"'", $txt);
Didn´t work.
-
November 30th, 2009, 04:50 PM
#2
Re: tinyMCE - Alter url
Why don't you just use stripslashes()?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 30th, 2009, 05:10 PM
#3
Re: tinyMCE - Alter url
Right. I could do that but I´d like to know what I should do to get that piece of code working
And if I do that for the link http://www.site.com I get http://../
Last edited by rogernem; November 30th, 2009 at 05:47 PM.
-
November 30th, 2009, 06:13 PM
#4
Re: tinyMCE - Alter url
The code you posted is a waste. Use the following. If that isn't returning what you want, then the posted variable is incorrect. If that is the case, then we need more relevant code.
PHP Code:
$txt = stripslashes($_POST['text']);
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 30th, 2009, 06:38 PM
#5
Re: tinyMCE - Alter url
I did exactly like that: $txt = stripslashes($_POST['text']);
But its not returning what I need. I think it is a tinyMCE issue.
That´s why I was trying to use my code.
With my code
Code:
$txt = stripslashes($_POST['txt']);
$txt = str_replace('"',"'", $txt);
Im getting:
<a href='..//' target='_blank'>http://www.site.com</a>
site (<a href='http://test.site.com' target='_blank'> -> THIS IS THE ONLY ONE NOT LOSING THE LINK
What is the other solution? Any other ideas?
Thanks
Last edited by rogernem; November 30th, 2009 at 06:43 PM.
-
November 30th, 2009, 06:51 PM
#6
Re: tinyMCE - Alter url
What is the exact return of the posted variable text? Can you put it in [quote] tags?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
December 1st, 2009, 11:19 AM
#7
Re: tinyMCE - Alter url
this is the return
<a href="..//" target="_blank">http://www.site.com</a>
site (<a href="http://test.site.com" target="_blank">
-
December 1st, 2009, 11:58 AM
#8
Re: tinyMCE - Alter url
Try the following...
PHP Code:
preg_match('/site \(<a href="(.*?)"/i', $_POST['text'], $matches); echo '<p><a href="' . $matches[1] . '" target="_blank">' . $matches[1] . '</a></p>';
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
December 1st, 2009, 01:17 PM
#9
Re: tinyMCE - Alter url
For some reason tinymce was replacing the url with ../
I downloaded the new version and doing the following it worked
tinyMCE
Code:
convert_urls : false
PHP
Code:
$txt= stripslashes($_POST['txt']);
$txt= str_replace('"',"'", $txt);
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|