[TYPO3-RTE] Anchors

Jean-Baptiste Rio triphot69 at hotmail.com
Fri May 12 10:20:24 CEST 2006


Hi List,


Sorry if my questions have been asked many times but i dive into the 
subjects without finding any solution.

First of all, really great job and thanks for deliver such a powerful tool.

I use rtehtmlarea v.1.4.1 and Typo3 v4.0 with PHP5. My team want to use 
anchors and to link theses anchors in a *unique* content (a wide article 
with multiple sections). So that, i can't use the automatic anchors 
created by Typo3.

1 - How can they create an anchor (<a name="myanchor" 
id="myanchor"></a>) in the RTE without writing the html ? Is the only 
possibility the tag button (<|>) ?
It could be useful to have a new button or tab "Anchor" in the browse 
link popup, isn't it ?

2 - It appears that there is a bug (or a missing feature... ;)) but when 
you select a page in the browse link popup, the lind returned is :
<a href=""http://www.mysite.com/?#myanchor" >bla bla</a>. The 
"index.php" is missing.
I dive into the code and i found the "bug" in 
rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php on line 241 :
$this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
which doesn't return index.php at the end of the site URL.
i suggest the following modification :

		if (strstr($this->siteURL,"index.php") != "index.php") {
			$this->siteURL .= "index.php";
		}
which corrects the bug.

The same problem occurs when you get the content from the database.
In class.t3lib_parsehtml_proc.php, line 686, function TS_links_rte, you 
have to modify :

		$siteUrl = $this->siteUrl();
		if (strstr($siteUrl,"index.php") != "index.php") {
			$siteUrl .= "index.php";
		}

Is this correction relevant ? or did i miss something ?

3 - The article will be used in several pages (same content linked 
several times). For the moment, when you link a anchor, you need to 
select the page *and* the anchor in the browse link popup. It works fine 
but it attachs the page id statically, so that, it won't be possible to 
use the content in several pages. How can I link an anchor *without* 
defining the page ?
I tried to modify the HTML code but it doesn't work. Suppose my anchor is :
<a href="http://www.mysite.com/index.php?id=1234#myanchor" >bla bla</a>
if i change to :
<a href="#myanchor" >bla bla</a>
HTMLarea changes it automatically to :
<a href="http://www.mysite.com/typo3/#myanchor" >bla bla</a>
which doesn't work anymore.
If you want to verify, just try with a simple anchor <a 
href="#myanchor"></a> and clic on the HTML button (<>) twice : "text" 
(modify the anchor to href="#myanchor")  => wysiwyg => text and you'll 
see that HTMLArea has modified the href value.
I spent several hours to find where in the .js files, it does the trick, 
without any success.
So question : How can i do the job ?

Thanks for your answers.

Regards,

JB



More information about the TYPO3-project-rte mailing list