[TYPO3-dev] The concept behind the model-array?

Franz Koch typo.removeformessage at fx-graefix.de
Sat Aug 1 10:31:07 CEST 2009


Hi Walter,

> thank your for your answer. Sorry, but I don't understand really how to benefit from that array. Perhaps I have to explain what I am trying to do.
> 
> I have a input field in my template. Now I want to query the database with the input value of that field, so I am going to have controller action, which is fired by the form. Ok.
> 
> But how can I access the input value from my model, so I can query my db according to the given value? I can't see how to manage the chain...
> So I hope you don't mind, I ask that stupid questions :-)

Your first post seemed to be about a totally different issue? So you're 
now simply looking for a way on how to access the equivalent for piVars 
from inside the model? Just hand the controller over to the model and 
grab it from there.


$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $tables, 
$where, $groupBy, $orderBy);
if($result) {
	while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
		// assuming that you're currently working in your controller, hand 
"$this" over to the model as second parameter
		$entry = new tx_lib_object($row,$this);
		$this->append($entry);
	}
}

 From inside the model you simply do this then:

$this->controller->parameters->get('fieldname');



-- 
kind regards,
Franz Koch

---------------------------------------------------
PayPal-Account: 'paypal _at_ elements-net _dot_ de'
---------------------------------------------------




More information about the TYPO3-dev mailing list