Adding PHP code in extension after every nth list element in TYPO3 -


i'm using old fashion way (kickstarter) build extension in typo3. ad php code after third element of list, don't know how this.

my code looks that:

protected function makelist($res) {     $items = array();         // make list table rows     while (($this->internal['currentrow'] = $globals['typo3_db']->sql_fetch_assoc($res)) !== false) {         $items[] = $this->makelistitem();     }      $out = '<div' . $this->pi_classparam('listrow') . '>list items</div>';     return $out; } 

and:

protected function makelistitem() {     $out = 'list item details';     return $out; } 

if understood correctly, need this:

protected function makelist($res) {     $items = array();     // make list table rows     $i = 0;     $out = '<div' . $this->pi_classparam('listrow') . '>';     while (($this->internal['currentrow'] = $globals['typo3_db']->sql_fetch_assoc($res)) !== false) {          $out .= $this->makelistitem();         $i++;         if ($i == 3) {              $out .= '<img src="whateverjpg">';              $i = 0; // if want every 3 images         }                 }       $out .= '</div>';     return $out; } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -