[TYPO3-dev] [TSRef - Bug #6461] (Resolved) TSref description for typolink is very unclear

mario m at mariochiari.net
Mon Jun 14 09:35:31 CEST 2010


Hi Francois,

very good!
Thanks
You typo3 guys are the best!
mario

----------------------
Issue #6461 has been updated by Francois Suter. 
      * Status changed from Accepted to Resolved
      * % Done changed from 0 to 100

Maybe you didn't even know how right you were when opening this bug
report ;-) Not only were the explanations not really clear enough, but
some features were actually undocumented. Here's the new version
(Committed to trunk in r376).

_This is the main data that is used for creating the link. It can be the
id of a page, the URL of some external page, a e-mail address or a
reference to a file on the server. On top of this there can be
additional information for specifying a target, a class and a title.
Below are a few examples followed by full explanations.

Examples:

parameter = 51
Most simple. Will create a link page 51.

parameter = 51 _blank specialLink "Very important information" 
A full example. A link to page 51 that will open in a new window. The
link will a class attribute with value "specialLink" and a title
attribute reading "Very important information". So the result will be
the following:

<a href="?id=51" target="_blank" class="specialLink" title="Very
important information">

parameter = http://typo3.org/ - specialLink
An external link with a class attribute. Note the dash (-) that replaces
the second value (the target). This makes it possible to define a class
(third value) without having to define a class.

parameter = info at typo3.org - - "Send a mail to main TYPO3 contact" 
Create a mailto link with a title attribute (but no target and no class)

As you can see from the examples, each significant part of the parameter
string is separated by a space. Values that can themselves contain
spaces must be enclosed in double quotes. Each of these values are
described in more detail below.

Destination
The first value is the destination of the link. If there's a @ it will
be considered to be a mail address and a mailto link will be created. If
the value contains a dot (.) before the first slash (/) or a double
slash (//) or if a scheme (like http) is found inside it, the link will
be considered to be an external one. If there's a slash but not a dot
before it, it is considered to be a path to a file and link is made to
it (even if it doesn't exist as it must consider that it might be a
speaking URL). In all other cases it is assumed that the value is either
a page id and a page alias and a link is made to that page, if it
exists.

In the case of a link to a page, the value can be more complex than just
a number or an alias. There can be three "sub-values" separated by
commas. Here's an example:

typolink.parameter = 51,100,&test=1 - - "RSS Feed"

The first value is the page id, the second is the type, the third will
override the "additionalParams" property. It's also possible to specify
a section that will override the section property. If the section mark
is an integer, it will be considered as a pointer to a tt_content
record. If not, it's used as is. If there's only a section mark, the
link is made to the current page. Examples:

typolink.parameter = 51#345
Create a link to page 51 with an anchor to tt_content element number 345

typolink.parameter = #top
Create a link to the current page with an anchor called "top".

It's also possible to direct the typolink to use a custom function (a
"link handler") to build the link. This is described in more details
below this table.

Target or popup settings
Targets are normally defined the properties described above (extTarget,
fileTarget and target) but it is possible to override them by explicitly
defining a target in the parameter property. It's possible to use a dash
(-) to skip this value when one wants to define a third or fourth value,
but no target (see examples above).

Instead of a target, this second value can be used to define the
parameters of a JavaScript popup window into which the link will be
opened (using window.open). The height and width of the window can be
defined, as well as additional parameters to be passed to the JavaScript
function. Also see property "Jswindow". Examples:

typolink.parameter = 51 400x300
Open page 51 in a popup window measuring 400 by 300 pixels

typolink.parameter = 51 400x300:resizable=0,location=1
Same as above, but window will not be resizable and will show the
location bar

Class
The third value can be used to define a class name for the link tag.
This class is inserted in the tag before any other value from the
"ATagParams" property. Beware of conflicting class attributes. It's
possible to use a dash (-) to skip this value when one wants to define a
fourth value, but no class (see examples above).

Title
The standard way of defining the title attribute of the link would be to
use the "title" property or even the "ATagParams" property. However it
can also be set in this fourth value, in which case it will override the
other settings. Note that the title should be wrapped in double quotes
(") if it contains blanks.

NOTE: When used from parseFunc, the value should not be defined
explicitly, but imported using:

typolink.parameter.data = parameters : allParams
_


________________________________________________________________________
Bug #6461: TSref description for typolink is very unclear 
      * Author: mario 
      * Status: Resolved
      * Priority: Should have
      * Assigned to: Francois Suter
      * Category: 
      * Target version: 

see [[http://bugs.typo3.org/view.php?id=13534]]


________________________________________________________________________

-----





More information about the TYPO3-dev mailing list