[TYPO3-mvc] Fluid and LaTeX

mario chiari m at mariochiari.net
Tue Jul 26 13:28:40 CEST 2011


Hello Lienhart, All

thanks for your support.

Things work, but I had resort to a trick to set the format='tex' that I
don't think I should need. So I am stil missing something.

My setting is:

-- extension created by Extbase Builder
-- Lienhart's patch
-- Author and Book domains 
-- add a new action latAction to authorController.php:
public function latAction() {              
                include_once('mario.php'); // tex-pdf machinery
                $new = new Mario;          
// $view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');  
// it does not seem I need the line above

$this->view->setTemplatePathAndFilename(t3lib_extMgm::extPath('Myext').'/Resources/Private/Templates/Author/Lat.tex');
// $this->request->setFormat('tex') 
// Note: to try to set the format='tex' as above doesn't work 
 		$authors = $this->authorRepository->findAll();
		$this->view->assign('authors', $authors);
                $new->texIt($this->view->render()); 
// texIt creates a .tex file $f, fputs($f,$this->view->render()), and
`pdflatex $f`,
	}
-- Classes/View/Author/LatTex.php    // Lat.php does not work
class Tx_Provadue_View_Autore_LatTeX extends
Tx_Fluid_View_StandaloneView  {
public function buildParserConfiguration() {
	$parserConfiguration = parent::buildParserConfiguration();
	$parserConfiguration->setShortHandOpenSymbol('\\\\fluid{');
	return $parserConfiguration;
	}
}
-- Resources/Private/Templates/Lat.tex
<f:layout name="Default" />
<f:section name="main">
\begin{itemize}
<f:for each="{autores}" as="autore">
\item  \fluid{autore.nome} 
</f:for>
\end{itemize}
</f:section>

-- Resources/Private/layouts/default.tex
<f:render section="main" />

--Resources/Private/layouts/default.html
<div class="tx-provadue">
<f:render section="main" />
</div>

Now, everything works IF I redefine the function resolveViewObjectName()
within authorController.php as it follows:

protected function resolveViewObjectName() {
		......
                if($this->request->getControllerActionName() ==
'lat'){$this->request->setFormat('tex');} <<<<<<<<<<<< 
		......
	}

Do I really need to do so? What do I miss to see?
Do  I need to pass  the new format to the
Tx_Extbase_MVC_Web_RequestBuilder::build() function? How?

Any further advise is very welcome.
Thanks
mario




On Mon, 2011-07-25 at 08:52 +0000, Lienhart Woitok wrote:
> Hello Mario,
> 
> again, I simply point you to the documentation in the wiki (you
> already know the link):
> http://forge.typo3.org/projects/typo3v4-mvc/wiki/How_to_userender_a_fluid_template_in_a_ServiceeIdCLI_Script3
> 
> Just replace the standalone view in the example code with your custom
> view (Tx_MyExt_View_TexView). This should do the trick.
> 
> Kind regards,
> 
> 
> Lienhart Woitok
> Web-Entwickler
....



More information about the TYPO3-project-typo3v4mvc mailing list