[TYPO3-mvc] IMAGE cObject and right viewhelper interaction [confused!!!]

Dmitri Pisarev dimaip at gmail.com
Fri Jun 11 18:26:13 CEST 2010


Hi list,
I need your help! Even if you do not understand what I ask below, then 
ask...
I have written the viewhelper that takes image src and other parameters, 
and then renders an IMAGE cObject. However I have a conceptual problem 
how to connect it in a clean way with StoreReadResponse viewhelper.
I need to have it to render the Article.image property before it gets to 
the StoreReadResponse viewhelper.
Is there a way to modify other fluid variables from viewhelper?
Is there a way to pass output of one viewhelper to another (to chain them)?

Ofcourse I can do the TS processing in the $articel->getImage(), but, 
IMO, it's mixing of model and view, as the html rendering belongs to the 
view... Or am I wrong and it's okay to do it via the getter?

Or am thinking totally in the wrong direction?
So guys, please help me solve it and I shall commit it to my library 
extension.

Thanks in advance,
Dmitri.

PS: if anyone needs, here's my image viewhelper:
***************************************************************
class Tx_Library_ViewHelpers_CImageViewHelper extends 
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {

     /**
      * @var tslib_cObj
      */
     protected $cObj;

     /**
      * Initializes the ViewHelper
      */
     public function initialize() {
         parent::initialize();
         $this->cObj = t3lib_div::makeInstance('tslib_cObj');
     }

     /**
      * Renders the cObject IMAGE
      *
      * @param string $src
      * @param int $width
      * @return string
      */
     public function render($src,$width = "80") {
         $theImgCode = '';
         $lConf['image.']['file.']['width'] = $width;
         $lConf['image.']['file'] = 'uploads/pics/' . $src;
         $theImgCode = $this->cObj->IMAGE($lConf['image.']);
         return $theImgCode;
     }
}


More information about the TYPO3-project-typo3v4mvc mailing list