[TYPO3-dev] Problem with changing query according to post-parameter

Walter Seeberger walk2moon at gmx.de
Sat Aug 1 09:59:29 CEST 2009


Hello David,

thank you for your answer. The thing you mentioned with changing the php style is absolutely correct. Much better to read. But when I changed to your example, I get an Illegal offset type in spl object.

Ok, the main problem is the following:

1. I run the first time my controller action:
The list with results appears.

2. I type something in my form and send it. 
the params are stored in the $POST and they are accessible.ok.
BUT
now there is no further list with results.

When I set an exchangeArray in my controller_action this way:
$view->exchangeArray($this->parameters);
I get this Fatal error: Call to a member function printAsText() on
> a non-object ... /template.php in line 9.

Without, simply there is no result list (no content object in the html)!

Do you have any other suggestions?

Regards,
Walter.
-------- Original-Nachricht --------
> Datum: Fri, 31 Jul 2009 18:35:53 +0200
> Von: David Bruchmann <typo3-dev at bruchmann-web.de>
> An: List for Core-/Extension development <typo3-dev at lists.netfielders.de>
> Betreff: Re: [TYPO3-dev] Problem with changing query according	to	post-parameter

> ----- Ursprüngliche Nachricht -----
> Von:        David Bruchmann <typo3-dev at bruchmann-web.de>
> Gesendet:   Freitag, 31. Juli 2009 18:28:19
> An:         List for Core-/Extension development 
> <typo3-dev at lists.netfielders.de>
> CC:
> Betreff:    Re: [TYPO3-dev] Problem with changing query according to 
> post-parameter
> > ----- Ursprüngliche Nachricht -----
> > Von:        Walter Seeberger <walk2moon at gmx.de>
> > Gesendet:   Freitag, 31. Juli 2009 14:14:51
> > An:         typo3-dev at lists.netfielders.de
> > CC:
> > Betreff:    [TYPO3-dev] Problem with changing query according to 
> > post-parameter
> >> Hello there,
> >>
> >> I try to react upon some post-parameters by changing data according to
> that in the model.ok:
> >>
> >> first I am doing some query and print the result trough my
> template.works!:
> >>
> >> <?php if($this->isNotEmpty()) { ?>
> >> 					<ul>
> >> 					<?php } ?>
> >> 					<?php for($this->rewind(); $this->valid(); $this->next()) {
> >> 						$entry = $this->current();
> >> 						?>
> >> 						<li><?php $entry->printAsText('name'); ?></li>
> >> 						<?php } ?>
> >> 						<?php if($this->isNotEmpty()) { ?>
> >> 					</ul>
> >> 	<?php } ?>
> >>
> >>
> >> Now I am using my form to put in some param. My template calls this
> function in the controller:
> >>
> >> public function formCallAction(){
> >> 	$modelClassName =
> tx_div::makeInstanceClassName('tx_testext_model_data');
> >>     	$model = new $modelClassName($this);
> >>         $model->load($this->parameters);	
> >> 	
> >>         $view = tx_div::makeInstance('tx_testext_view_resultlist');
> >> 	$view->exchangeArray($this->parameters);
> >> 	$view->controller($this);
> >> 	$view->render($this->configurations->get('resultlist'));
> >> 	
> >>         $className =
> tx_div::makeInstanceClassName('tx_lib_translator');
> >> 	$translator = new $className($this, $view);
> >> 	return $translator->translateContent();
> >>     }
> >>
> >> The result is: Fatal error: Call to a member function printAsText() on
> a non-object ... /template.php in line 9.
> >>
> >> Is anyone able to help me with this problem?
> >> Need some ;-)
> > 
> > 
> > Hi Walter first of all I propose to write the php like this:
> > 
> > <?php
> > 
> > if($this->isNotEmpty()) {
> > 	$content='<ul>';
> > 	for($this->rewind();
> > 		$this->valid();
> > 		$this->next()) {
> > 			$content.='<li>';
> > 			$this->printAsText( $this->current() );  ##
> > 			$content.='</li>';
> > 		}
> > 	}
> > 	$content .='</ul>';
> > 	echo $content;
> > }
> > 
> > ?>
> > 
> > It's a lot clearer to read and I think avoids some faults.
> > 
> > Concerning your problem have a look at line with the ## at the end.
> > I'm not sure, but $this->current() logically has no function
> printAsText().
> > 
> 
> Sorry, made a fault by myself:
> 
> if($this->isNotEmpty()) {
> 	$content='<ul>';
> 	for($this->rewind(); $this->valid(); $this->next()) {
> 		$content.= '<li>';
> 		$content.= $this->printAsText( $this->current() );  ##
> 		$content.= '</li>';
> 	}
> 	$content .='</ul>';
> 	echo $content;
> }
> 
> ?>
> 
> Best regards
> David
> 
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01




More information about the TYPO3-dev mailing list