[Typo3] EXT dev

Joshua Preston jpreston at americatab.com
Mon Feb 28 01:44:09 CET 2005


Pierre,

I will be the first to say that this is a MAJOR stumbling block for 
myself as well.  I have noticed that my constants and setup must contain 
something similar to the following, which I'll give explaination and 
howto...

Since I don't have any of your code to look at, I'll assume you can 
decipher mine ;-)  Which may or may not be the best or correct way.

First you need to make 100% positive you are naming the plugin 
properly.  I find that the name given to it by the Extention Kickstarter 
is given in the class php.  Go there first of all.

Look for the $prefixId, for the following examples change $prefixId to 
the name of your $prefixId as defined in your class...  You'll also need 
to change all of the <directory_of_plugin> to the correct directory... 
and <name_of_template_file> to the correct template file, pending you 
are using templates...

------------------------------------------
## Constant file: ext_typoscript_constants.txt
plugin.$prefixId {
    ## We're going to define all these as constants so we can edit them 
using the constant editor for
    ## greater compatibility...

    # cat=plugin.$prefixId/file; type=file[html,htm,tmpl,txt]; label= 
Template File: HTML-template file
    file.templateFile = 
EXT:<directory_of_plugin>/pi/<name_of_template_file>.tmpl

    # cat=plugin.$prefixId/enable; type=boolean; label= Disable to hide 
myVar from the displayed data.
    myVar.visible = 1

    # cat=plugin.$prefixId//; type=string; label= Override the default 
value of myVar.
    myVar.value = Some random string.

    # cat=plugin.$prefixId/typo; type=wrap; label= Override the default 
wrapping of myVar.
    myVar.wrap = <center> | </center>
}
-------------------------------------------
## Setup file: ext_typoscript_setup.txt
## Our setup keeps all the values editable with the constant editor, so 
it assigns the value
## from the constants if it hasn't been overridden.

## Includes the lib:
includeLibs.$prefixId = EXT:<directory_of_plugin>/pi/class.$prefixId.php

## This enables the tt_content.list item to display the news:
plugin.$prefixId >
plugin.$prefixId = USER
plugin.$prefixId {
  userFunc = $prefixId->main
  templateFile = {$plugin.$prefixId.file.templateFile}

  # set myVar wraps, default's if not overridden!
  myVar.wrap = {$plugin.$prefixId.wrap}

  # find out if we're even going to show it!
  myVar.visible = {$plugin.$prefixId.myVar.visible}

  # set the value of myVar, default's if not overridden!
  myVar.value = {$plugin.$prefixId.myVar.value}
}
--------------------------------------------

Then if all goes well, you can access them in your main function by 
utilizing:

---------------------------------------
...
...
...
function main($content, $conf) {
    $this->conf = $conf;

    if ( $this->conf['myVar.']['visible'] == '1' ) {
       $myVar = $this->conf['myVar.']['value'];
       $content = 
$this->cObj->stdWrap($this->conf['myVar.'],$this->conf['myVar.']);
    } else {
       $conent = 'Sorry, myVar is hidden.';
    }

    // commented out, but good for testing!
    // return "Hello World!<HR>Here is the TypoScript passed to the 
method:". t3lib_div::view_array($conf);
    return $content;
}
...
...
...
----------------------------------------

Hope this helps you out a little bit!

Thanks!

Joshua Preston.


Pierre wrote:

> Hi there,
>
> I'm developing an extension and i'm in trouble with how to put some TS 
> by default ?
> i have this into the setup of my template : 
> plugin.tx_rspphotomanager_pi1.basePath = fileadmin/webphoto/
> and i wanna put it in my extension directly via the setup and constant 
> text files ... But there's something i surely misunderstood cause i 
> allways have nothing pass to my class.
> Is there any hint i should know ?
> Thanks for any information please ?
> Cheers
> Pierre
> _______________________________________________
> Typo3-english mailing list
> Typo3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english





More information about the TYPO3-english mailing list