[Typo3] Custom Tag typoscript $content

Joshua Preston jpreston at americatab.com
Sun Feb 27 03:08:24 CET 2005


Naive,

I hear ya, I have solved this little dilemma, or at least I think our 
dillemma's are similar! LOL.  In my plugin, I have to make a call to an 
external (MS SQL) database and return the results and what-not.  
Hopefully this helps you out some!

Anyhow without further adeiu,

I make a form and post to:

$this->pi_getPageLink($GLOBALS["TSFE"]->id)

so in essence, I perform the following steps (may or may not be the best 
way!):

function main($content, $conf) {
    $this->conf = $conf;
    $this->pi_setPiVarDefaults();
    $this->pi_linkVars = $GLOBALS['TSFE']->linkVars;

    if ( $this->pi_getVars['input1'] ) { // The form was submitted and 
input1 has a value...
        $content = 'The value of input1 is: ' . $this->pi_getVars['input1'];
    } else { // The form needs to be displayed!
        $content = '<center><form action="' . 
$this->pi_getPageLink($GLOBALS["TSFE"]->id) . '" method="POST">\n';
        $content .= '<input size="8" type="text" name="' . 
$this->prefixId . '[input1]" value="input1">\n';
        $content .= '<input type="submit" name="'. $this->prefixId . 
'"[submit_button]">\n';
        $content .= '</form></center>';
    }
    return $this->pi_wrapInBaseClass($content);
}

But, it works for my needs!

Thanks!

Joshua Preston.

Mark Gillingham wrote:

> The Custom Tag is a wonderful tool for shortcuts and tags. Being 
> naive, I'm wondering about what can be returned in a typoscript 
> $content variable. For instance, can I create forms in php, attach to 
> an external database, and return the result in the $content? Further, 
> if a form were created in an include file, what is the variable to set 
> the submit to.
>
> Naive
> _______________________________________________
> 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