1

Topic: Options for converting URLs.

Here is a FAQ entry on how to use the various URL options:

http://wiki.moxiecode.com/index.php/Tin … ve_URLs.3F

Best regards,
Spocke - Main developer of TinyMCE

2

Re: Options for converting URLs.

How can I make it  not replace links like <a href="#">link</a> ?

3

Re: Options for converting URLs.

I have read through lots and lots of posts on this subjet even the FAQ, but I'm still having problems. My init call looks like this:

tinyMCE.init({
    theme : "advanced",
    plugins : "table,save,advimage,advlink,insertdatetime,preview,searchreplace,print,contextmenu,fullscreen,directionality,paste,noneditable",
    theme_advanced_buttons1_add_before : "save,separator",
    theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
    theme_advanced_buttons3_add_before : "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
    theme_advanced_buttons4 : "tablecontrols",
    theme_advanced_buttons3_add : "separator,print,separator,ltr,rtl,separator,fullscreen",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    plugin_insertdate_dateFormat : "%Y-%m-%d",
    plugin_insertdate_timeFormat : "%H:%M:%S",
    content_css : "/ui/light.css",
    convert_urls : false,
    remove_script_host : false,
    mode : "textareas"
});

What I really want is url entered in links and images to be left like they were written. First I tried using neither convert_urls nor remove_script_host didn't work obviously, then I tried just adding the convert_urls didn't work either, although Firefox did present a functional version though keeping the (/) infront of the url, while IE (as usual) were complete hopeless. It didn't however produce my full path that I had entered (http://www.domain.com/path/subpath/file.html). while Firefox returned this: /path/subpath/file.html which could be used. IE produced path/subpath/file.html which obviously points at the wrong file. Now what I really wanted i to do, was not changing the url at all the FAQ told me to just add the convert_urls : false, that didn't work.

On a forum post I found a suggestion inorder to always save the full url was to use: remove_script_host : false as well, this worked in Firefox, which displayed the full url. However IE didn't. Now I don't know what to do to solve the problem, I would really prefer not having to do any script related replacement in either JS or PHP.

Please is there a solution to this?

Best regards:
Tommy

UPDATE: I stand corrected, it doesn't work at all... sad

Last edited by tommya (2006-01-12 15:05:11)

4

Re: Options for converting URLs.

I'm going very well with these options:
    relative_urls : false,
    convert_urls : false,

regards,
samuel

5

Re: Options for converting URLs.

That made it work in Firefox as intended, but it still doesn't work in IE...

In your FAQ it is said that only convert_urls: false is needed, when you want to leave urls as they are. Apparently it needs more than that, http://tinymce.moxiecode.com/tinymce/do … html#paths but still sad I can't make it work in IE sad

6

Re: Options for converting URLs.

I've installed TinyMCE as a Drupal module and I'm really unlcear where I would set "convert_urls : false".

7

Re: Options for converting URLs.

Issue:  When I insert a link (that has an '&' in it) into the WYSIWYG editor like sayfor example, http://www.site.com/viewcatalog.asp?cat … prodID=53, the html that is spit out changes the '&' to &amp like this...  http://www.site.com/viewcatalog.asp?cat … prodID=53.  This breaks the link! 

Anyone else encountered/conquered this bug?  If so any suggestions would be greatedly appreciated.

8

Re: Options for converting URLs.

kentharris wrote:

Issue:  When I insert a link (that has an '&' in it) into the WYSIWYG editor like sayfor example, http://www.site.com/viewcatalog.asp?cat … prodID=53, the html that is spit out changes the '&' to &amp like this...  http://www.site.com/viewcatalog.asp?cat … prodID=53.  This breaks the link! 

Anyone else encountered/conquered this bug?  If so any suggestions would be greatedly appreciated.

Why do you think this is a bug?  The ampersand in the URL *must* be represented by an entity reference in a CDATA attribute such as href.

9

Re: Options for converting URLs.

notorious_kev wrote:
kentharris wrote:

Issue:  When I insert a link (that has an '&' in it) into the WYSIWYG editor like sayfor example, http://www.site.com/viewcatalog.asp?cat … prodID=53, the html that is spit out changes the '&' to &amp like this...  http://www.site.com/viewcatalog.asp?cat … prodID=53.  This breaks the link! 

Anyone else encountered/conquered this bug?  If so any suggestions would be greatedly appreciated.

Why do you think this is a bug?  The ampersand in the URL *must* be represented by an entity reference in a CDATA attribute such as href.

Perhaps because the last url won't work as intended

10

Re: Options for converting URLs.

I've the same problem.

Links that contains "&" character are rewriting to "&" ...

Is it a bug ?

Is ther someone who have a solution ?

11

Re: Options for converting URLs.

& in urls have to be rewritten as "&"...

12

Re: Options for converting URLs.

Thanks for your answer.

Indeed, URLs like "zz.php?ee&t=eee" works fine with FF or IE...

13

Re: Options for converting URLs.

Is there an option to stop text starting with "www." from being converted to a hyperlink?
I've got these in my init...
, convert_urls: false
, relative_urls: false
...which prevents it changing www.mysite.com to http://www.mysite.com/ but it's still adding the anchor tags. (ie, converting to <a href="http://www.mysite.com">www.mysite.com</a>)

- Peter Boughton -

14

Re: Options for converting URLs.

I know this has been discussed and I have been reading posts all day about it, without resolving my confusion.  And please don't just tell me to read this:  http://tinymce.moxiecode.com/tinymce/do … html#paths  Unfortunately, this does not explain my problem.

I am using TinyMCE as a stand alone editor. Here is the absolute URL to the html file that has the tinyMCE.init({...}) and the editable text area. I did a completely normal installation and all TinyMCE components are located in their usual place relative to the  "/tinymce/jscripts/tiny_mce" directory where the "tinymce.html" file is located:

"http://123.456.789.1/~myhome/tinymce/TE … nymce.html"

What is the "document_base_url"? TinyMCE does not load at all if I use any of the following in my init statement:

    relative_urls : false,
    document_base_url : "http://123.456.789.1/~myhome/tinymce/TE … nymce.html"
or
    relative_urls : false,
    document_base_url : "http://123.456.789.1/~myhome/tinymce/TE … s/tiny_mce"
or:
    relative_urls : true,
    document_base_url : "http://123.456.789.1/~myhome/tinymce/TE … nymce.html"
or
    relative_urls : true,
    document_base_url : "http://123.456.789.1/~myhome/tinymce/TE … s/tiny_mce"

or any other variation of "true/false" and URL right down to the bare IP.

TinyMCE does work if I put the following in the init statement:

    relative_urls : false,
    <!-- document_base_url : "http://123.456.789.1/~myhome/tinymce/TE … s/tiny_mce" -->

or just leave it out altogether.

Unfortunately, my plugins that require a path don't work without a correct "document_base_url". I would really appreciate if someone would please clarify what is the document base url in the above absolute URL. And the reason the URL path has only an IP is that there is no domain name for the site. And, yes, I have changed the IP and home directory names because they are a company test site.

Sincerely, Michael Wassil

Last edited by amwassil (2006-04-11 00:35:41)

15

Re: Options for converting URLs.

Try it without an IP address as the hostname?

ie:

http://WWW.DOMAIN.COM/tinymce/TEST....

The problem might be the IP method of addressing is messing things up?

16

Re: Options for converting URLs.

hellcat wrote:

How can I make it  not replace links like <a href="#">link</a> ?

I've got the same problem, and unless I can figure it out I'll have to drop TinyMCE and look for something else.

17

Re: Options for converting URLs.

You can always piggy back and convert any URLs your self:
http://tinymce.moxiecode.com/tinymce/do … lback.html

Best regards,
Spocke - Main developer of TinyMCE

18

Re: Options for converting URLs.

You can always piggy back and convert any URLs your self:
http://tinymce.moxiecode.com/tinymce/do … lback.html

Spocke, I have a quick question for you... with regard to this "php in the URL" problem here:

http://tinymce.moxiecode.com/punbb/view … 415#p11415

(php code is "url encoded", so it is no longer valid...)

Do you think I can do something like this: (I don't know js, so I used pseudo-code to illustrate..)

function myCustomURLConverter(url, node, on_save) { 

     if (url contains "<!--PHPCODEPHP") then { 

          // Our url contains some php code that was "url converted" by tinyMCE. 
          // Now we need to convert it back. 
     
          url = Do conversion (remove URL encoding) 

     } 

     // Return new URL 
     return url; 
}

Do you think something like that would solve the problem of PHP code within a URL being "url encoded" by tinyMCE?

Let me know what you think.

19

Re: Options for converting URLs.

Yes, then you would have total control.

Best regards,
Spocke - Main developer of TinyMCE

20

Re: Options for converting URLs.

I'm using tinymce on drupal on WIMP - windoze, IIS, mysql and php.  everything is working great except...
how do I create a unc link to a file on a fileserver?   For instance, Windoze knows when I link to

\\fileserver\sharename\file.doc

to automatically start Word or openoffice or whatever application is associated with .doc

I've read the FAQs and still have questions...

I'm assuming I need to turn off convert_urls... how??  In tiny_mce_src.js?  if so, where, and how do I convert that to tiny_mce.js?  I don't see any indication of how or where to change these variables...searching the source hasn't helped me much...

The only related item on UNC paths I found was this..
http://tinymce.moxiecode.com/punbb/view … ?pid=11065

Thanks,
Dusty

21

Re: Options for converting URLs.

I figured it out...

in drupal module tinymce.module function tinymce_process_textarea, I simply added a line to set convert_urls to false

    $settings[] = 'convert_urls : false';

    $tinymce_settings = implode(",\n    ", $settings);

    $enable  = t('enable rich-text');
    $disable = t('disable rich-text');

$tinymce_invoke = <<<EOD
<script type="text/javascript">
  tinyMCE.init({
    $tinymce_settings
  });
</script>
EOD;

22

Re: Options for converting URLs.

"Easy to integrate, takes only two lines of code."

I wish this was true.  I have attempted for days to integrate tinyMCE with a blank page developed in Dreamweaver / PHP, and again in Drupal, and both times am not able to see any functionality in the end-user screen.  No GUI, no tinyMCE engine apparently working.

I have reviewed and implemented your "path" suggestions, as well as install in the site and the sub-site root directories to see if that might make a difference. 

I am under the impression that this is very much "not" a tool for anything but hardcore developers.  I could be wrong but have hit a wall and need to pull out unless you can suggest something else or a resource / reference for getting tinyMCE to work.  The net and the forums are full of data, but little I have found that is targeted and relevant to this need.  Please let me know what you think.

Respectfully, paul

23

Re: Options for converting URLs.

Hmm, it couldn't be more simple. Simply copy paste the code to the correct location in the head tag of you page and make sure that the paths are correct to the javascript. I've seen n00bs on this forum that don't even know what JavaScript is beeing able to performe this operation so I don't think it's for hardcore developers only.

But if you are using Drupal, why not use the module that they developed?
http://drupal.org/project/tinymce

Or if you have specific path problems:
http://tinymce.moxiecode.com/tinymce/do … html#paths

Best regards,
Spocke - Main developer of TinyMCE

24

Re: Options for converting URLs.

spocke, thanks for the reply.  I named an absolute path to tinyMCE in the header and it called the engine.  Very cool, as the gui is now showing up on a test PHP file.

However, when I "save" changes made in the browser, they do not take.  The screen essentially refreshes to where it was.  I am simply attempting to give designated "power users" control over the content on specific screens, and am wondering if this application requires that text areas be connected with a database or anything else?

How can I get changes made to stick?

thanks, paul

25

Re: Options for converting URLs.

Paul,

The answer to your question is yes.  You MUST connect the output from tinyMCE to some kind of server-side processing system.. this is external from tinyMCE and has nothing to do with editing of the html file/code, etc...

Here's how it works:

1) You get some html code into your text area (you are responsible for this part.)

2) You activate tinyMCE and edit the html code.

3) You "save" your tinyMCE editing, and it outputs the new html code you created.

4) Your program must now take the text area FORM submit value, and do whatever is needed.  (save it to file, insert to database, etc.)  You are responsible for this part.