[Typo3-dev] How to add parameters to: pi_linkTP_keepPIvars()

Christopher tombedlam at yahoo.com
Sun Oct 17 19:15:51 CEST 2004


Hi,

--- Adrien Laurent <a.laurent at blastingweb.net> wrote:

> Hello everybody,
>  
> The Extension Kickstarter generates a link for me with the function:
>
$this->pi_linkTP_keepPIvars($title,array('pointer'=>($a?$a:'')),$this->pi_isOnlyFields($this->pi_isOnlyFields))
> But I need to had a parameter (class = "mycssclass") to the <a
> href....
> How can I do this ?
> Do I need to to wrap the return of pi_linkTP_keepPIvars with another
> function ?


Ok, there are four parts to the solution ;)

1. Install the Extension Development Evaluator extension from the
repository, so you can display the source documentation from
tslib/class.tslib_pibase.php [1]

2. Check out the function function 'pi_linkTP_keepPIvars_url()' which,
according to the source documentation, is "...Same as
pi_linkTP_keepPIvars but returns only the URL from the link".

3. Then check out Karsten Hachmeister's helpful 'Make Correct
Typolinks' tutorial [2]; you can use the output from
pi_linkTP_keepPIvars_url() as one of the paramaters of the typolink.

4. Then add the class *to the typolink* as 'ATagParams' [3]


Making your links as typolinks has the advantage that properties - such
as css classes - of the link can be added/removed/altered by whoever
uses your extension with Typoscript.

Finally, think about whether or not *each* link actually needs a class;
if you simply want to style each link in a particular way, it will
often work just as well to style the links' *container* (less code,
same result) and, if you are templating the extension too, will allow
the end user to style the links from the *template AND from Typoscript*
for maximum flexibility:


CSS:

div#tx_myExtension {
/* Styles for extension output container */
  ...
}

div#tx_myExtension div#links a {
/* Properties for all links in this container only */
    text-decoration:none;
    font-weight:bold;
}

div#tx_myExtension div#links a:link,
div#tx_myExtension div#links a:visited {
/* Properties for links and visited links in this container only */
  color:#FF9900;
}

div#tx_myExtension div#links a:hover,
div#tx_myExtension div#links a:active {
/* Properties for hover and active states of links in this container
only */
  color:#990000;
  border-bottom:1 px dotted #990000;
}


HTML:

<div id="tx_myExtension">
<!-- Extension output... -->
<p>Lorem ipsum dolor sit amet...</p>

  <!-- Extension browse-menu... -->
  <div id="links">
    <a href="...">Link Item</a>
    <a href="...">Link Item</a>
    <a href="...">Link Item</a>
    <a href="...">Link Item</a>    
  </div>
</div>


-Christopher


[1] http://typo3.org/extensions/repository/search/extdeveval/
[2] http://typo3.hachmeister.org/Make_correct_Typolinks.412.0.html
[3] http://typo3.org/documentation/document-library/doc_core_tsref/typolink/


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 




More information about the TYPO3-dev mailing list