[Typo3] Pass value via PHP to extension?

Matthias Taugwalder matthias.taugwalder at bluewin.ch
Fri Jul 29 17:48:34 CEST 2005


So, finally I solved it...

The trick is that you have in typoscript to pass the parameters directly to
the extension.

i.e.

--- Typoscript code ---

plugin.<the_prefixId_of_your_extension> {
   key1 = value1
}


Then you can access the parameters in your extension as follows:

...

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

		$content = "The value of key1 is" . $conf['key1'];

		return $this->pi_wrapInBaseClass($content);
	}

...




Best regards,

Matthias Taugwalder
 
---
Matthias Taugwalder
matthias.taugwalder at bluewin.ch
 

> -----Original Message-----
> From: typo3-english-bounces at lists.netfielders.de 
> [mailto:typo3-english-bounces at lists.netfielders.de] On Behalf 
> Of Matthias Taugwalder
> Sent: Freitag, 29. Juli 2005 17:44
> To: 'TYPO3 English'
> Subject: Re: [Typo3] Pass value via PHP to extension?
> 
> 
> > That would do the trick to indeed...
> > I personally hate to have my TS code spread across my site 
> because O 
> > won't have any overview on it anymore..... It's just personall I 
> > guess.
> 
> The problem is that the key pairs for the database select 
> query can be on more pages the same. So, a seperation of 
> parameters and code is cleaner than hard coding it...
> 
> However, I'm still working it...
> 
> The setting of the parameters doesn't seem to be a problem, 
> but accessing them via PHP. I can't find the typoscript 
> parameters or parts of the typoscript object tree in the 
> different GLOBALS arrays which can be read from PHP.
> 
> Strange... Has anyone this tried before?
> 
> 
> 
> 
> Thanks & best regards,
> 
> Matthias Taugwalder
>  
> ---
> Matthias Taugwalder
> matthias.taugwalder at bluewin.ch
>  
> 
> > -----Original Message-----
> > From: typo3-english-bounces at lists.netfielders.de
> > [mailto:typo3-english-bounces at lists.netfielders.de] On 
> Behalf Of Ries 
> > van Twisk
> > Sent: Freitag, 29. Juli 2005 10:37
> > To: TYPO3 English
> > Subject: Re: [Typo3] Pass value via PHP to extension?
> > 
> > Matthias Taugwalder wrote:
> > 
> > >Thanks for your reply.
> > >
> > >  
> > >
> > >>Depending on how many pages you can make conditions based
> > on the UID
> > >>of the page.
> > >>Then within the condition you can specify the parameter to
> > the plugin.
> > >>    
> > >>
> > >
> > >I probably try to set the parameters as typoscript constants in an 
> > >extension template for each page, then they are set in the
> > template as
> > >parameters of the global config array. And then I access 
> this config 
> > >array in the php script...
> > >
> > >This should do the trick...
> > >
> > >  
> > >
> > That would do the trick to indeed...
> > I personally hate to have my TS code spread across my site 
> because O 
> > won't have any overview on it anymore..... It's just personall I 
> > guess.
> > 
> > Ries
> > 
> > _______________________________________________
> > Typo3-english mailing list
> > Typo3-english at lists.netfielders.de
> > http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> > 
> 
> _______________________________________________
> 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