[TYPO3-mvc] frontend plugin and pdf_generator2

Reginaldo Arredondo reggiearre at googlemail.com
Fri Dec 31 03:07:58 CET 2010


Hi Franz,

thanks again for your reply. You might have missed my last answer though.
I solved the problem with include_post_vars in the template setup. I forgot
that this possibility exists, so the whole problem was solved with this
line:

lib.empty_fce.stdWrap.postUserFunc.include_post_var

The PDF is rendered correctly now. But there is just one little thing in
addition... The PDFs url looks like this:

http://127.0.0.1/bn_quicksite_2.1/index.php?id=24&type=123&tx_rafreighttracking_publicsearch[action]=show&tx_rafreighttracking_publicsearch[controller]=Booking&cHash=711ae9d5d2c2459aaa7cb58f53233370&tx_rafreighttracking_publicsearch[__referrer][extensionName]=RaFreighttracking&tx_rafreighttracking_publicsearch[__referrer][controllerName]=Booking&tx_rafreighttracking_publicsearch[__referrer][actionName]=index&tx_rafreighttracking_publicsearch[__hmac]=a%3A5%3A{s%3A13%3A\%22bookingnumber\%22%3Bi%3A1%3Bs%3A10%3A\%22billnumber\%22%3Bi%3A1%3Bs%3A15%3A\%22containernumber\%22%3Bi%3A1%3Bs%3A6%3A\%22action\%22%3Bi%3A1%3Bs%3A10%3A\%22controller\%22%3Bi%3A1%3B}d471aabc4734fb6330b8cd7b9a45eb00a792ed4e&tx_rafreighttracking_publicsearch[bookingnumber]=SA001&tx_rafreighttracking_publicsearch[billnumber]=&tx_rafreighttracking_publicsearch[containernumber]=

Of course I would like it to be a little bit nicer. But I don´t know how to
do that with realurl. I read somewhere, that it is not possible, because
pdf_generator2 doesn´t use the normal way to generate that url. Is that
correct?

If yes, does anybody know a solution?

P.S.: Is this the right list for this question? Should I send a new mail
with new subject for this question?

Regards,
Reggie
On Thu, Dec 30, 2010 at 7:34 PM, Franz Koch <
typo3.RemoveForMessage at elements-net.de> wrote:

> Hey,
>
>
>  The PDF should be generated out of the detailed view. Once a user searched
>> for a booking and sees its details, I want to provide the possibility to
>> click on the PDF generator link (in my case an image) and see the detailed
>> view (in other words: the current page) as PDF.
>>
>> I changed the method of the search form to get.
>> <f:form controller="Booking" action="show" method="get">
>> Bookingnumber:<f:form.textbox name="bookingnumber" />
>> Billnumber:<f:form.textbox name="billnumber" />
>> Containernumber:<f:form.textbox name="containernumber" />
>> <f:form.submit value="Search" />
>> </f:form>
>>
>> Now I get this url:
>>
>> http://127.0.0.1/bn_quicksite_2.1/customer-service/freight-tracking/?tx_rafreighttracking_publicsearch[__referrer][extensionName]=RaFreighttracking&tx_rafreighttracking_publicsearch[__referrer][controllerName]=Booking&tx_rafreighttracking_publicsearch[__referrer][actionName]=index&tx_rafreighttracking_publicsearch[__hmac]=a%3A5%3A{s%3A13%3A%22bookingnumber%22%3Bi%3A1%3Bs%3A10%3A%22billnumber%22%3Bi%3A1%3Bs%3A15%3A%22containernumber%22%3Bi%3A1%3Bs%3A6%3A%22action%22%3Bi%3A1%3Bs%3A10%3A%22controller%22%3Bi%3A1%3B}d471aabc4734fb6330b8cd7b9a45eb00a792ed4e&tx_rafreighttracking_publicsearch[bookingnumber]=SA001&tx_rafreighttracking_publicsearch[billnumber]=&tx_rafreighttracking_publicsearch[containernumber]=&=Search<http://127.0.0.1/bn_quicksite_2.1/customer-service/freight-tracking/?tx_rafreighttracking_publicsearch[__referrer][extensionName]=RaFreighttracking&tx_rafreighttracking_publicsearch[__referrer][controllerName]=Booking&tx_rafreighttracking_publicsearch[__referrer][actionName]=index&tx_rafreighttracking_publicsearch[__hmac]=a%3A5%3A%7Bs%3A13%3A%22bookingnumber%22%3Bi%3A1%3Bs%3A10%3A%22billnumber%22%3Bi%3A1%3Bs%3A15%3A%22containernumber%22%3Bi%3A1%3Bs%3A6%3A%22action%22%3Bi%3A1%3Bs%3A10%3A%22controller%22%3Bi%3A1%3B%7Dd471aabc4734fb6330b8cd7b9a45eb00a792ed4e&tx_rafreighttracking_publicsearch%5Bbookingnumber%5D=SA001&tx_rafreighttracking_publicsearch%5Bbillnumber%5D=&tx_rafreighttracking_publicsearch%5Bcontainernumber%5D=&=Search>
>>
>> The good thing: now the variables I need for the PDF generation are in the
>> url.
>> But the detailed view is not shown. -  The actionName is "index" in the
>> url
>> although I set it to "show" in the form. Why is that?
>> I didn´t change anything but the method in the form. If I change it back
>> to
>> post, the detailed view is shown.
>>
>> Is this the way you suggested?
>>
>
> yepp, it is. I forgot about the overhead that doesn't look very nice in the
> URL. And to bad that the actionName doesn't work - looks like a bug.
>
>
>  Is there a way to just add the bookingnumber, billnumber and
>> containernumber
>> variables to the PDF generation link?
>>
>
> The only other clean solution that comes to my mind would be to either use
> a viewHelper for this or do a redirect.
>
> a) viewHelper
> You could either use a custom viewHelper that's creating the pdf link
> button internally using the API of the pdf extension (if available) or
> render the PDF button using the cObject viewHelper rendering a custom TS
> snippet.
>
> b) redirect
> If a booking was found, do a redirect to a dedicated detail view
> page/action, that probably looks the same (so also with the search form on
> top) but has a nice and clean URL. But this has the downside of a processing
> overhead due to the redirect.
>
>
> public function indexAction(Tx_YourExt_Domain_Model_BookingDemand $demand =
> NULL) {
>        if ($demand !== NULL && is_object($demand)) {
>                $booking =
> $this->bookingRepository->findDemanded($demand)->getFirst();
>                if (is_object($booking) && $booking->getUid()) {
>                        $this->redirect('show', NULL, NULL, array('booking'
> => $booking->getUid());
>                }
>        }
>
>        $this->view->assign('demand', $demand);
> }
>
> public function showAction(Tx_YourExt_Domain_Model_Booking $booking) {
>        $this->view->assign('booking', $booking);
> }
>
>
> As you might have noticed in this example, I use a demand object instead of
> the nested if clauses you mentioned. This might be a more elegant way and
> probably more flexible way to do it, but yours is also fine as long as it's
> working.
>
> --
> kind regards,
> Franz Koch
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list