[TYPO3-mvc] capture and re-use controller/view output

Henjo Hoeksma me at henjohoeksma.nl
Fri Nov 25 12:54:22 CET 2011


Hi Loek,

well, the key is they are almost the same. So it are 2 different actions.

If I need some login in multiple actions I usually create a protected
function for that in the respective controller.
This way you are working clean: the method cannot be reached from another
place as where you want and it's possible to call the method in both
actions.
Some times to keep my action smooth, I put logic in a protected function
anyway, just to keep simple and clean.

PS the part in the documentation of FLOW3 on OOP is actually pretty nice.
Read a nice tutorial on MVC to get familiar with it's basic concepts. It's
actually pretty straightforward.

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Fri, Nov 25, 2011 at 12:32, Loek Hilgersom <loek at netcoop.nl> wrote:

> Hi Henjo,
>
> Thank you for answering. Creating partials is definately a must, but then
> I am still producing two almost identical controllers and that just doesn't
> look like the best way to do it. The task-list is a sort aggregate list of
> different types of objects, and therefor the controller needs to do a bit
> more than just assigning an object to a view.
>
> Maybe there is too much logic in the controller now, and I need to move
> that to the views? I'm still struggling with all the new MVC concepts etc,
> suggestions are more than welcome.
>
> Loek
>
>
>
> On 11/25/2011 09:55 AM, Henjo Hoeksma wrote:
>
>> Hi Loek,
>>
>> if I follow you correctly, this is the thing you would want to do:
>>
>>
>>    1. Create an EmailService that will handle the emailing [1]
>>    2. Create a Schedular Task calling a notifyAchtion() (whatever you want
>>    to name it) [1]
>>    3. Create your email template and use Partials to avoid writing double
>>    templates as much as you can.
>>
>> [1] For both there a some good threads around to give you the info you
>> need
>> on how to achieve this.
>>
>> Kind regards,
>>
>> Henjo
>>
>> Problems are small because we learned how to deal with them.
>> Problems are big because we need to learn how to deal with them.
>>
>>
>> On Thu, Nov 24, 2011 at 15:48, Loek Hilgersom<loek at netcoop.nl>  wrote:
>>
>>  Hi List,
>>>
>>> I have a controller/view that creates a tasklist for the user that is
>>> currently logged in. Now I want to make a script that will send each user
>>> an email with their tasklist. To do that, I don't want to duplicate the
>>> logic for creating the tasklists. Preferrably, I would provide the
>>> controller with the id of the user and a modified view (for email,
>>> instead
>>> of screen display) and then capture the output of the view to send it by
>>> email.
>>>
>>> My question is, how do I capture the output of a normal view in a
>>> variable
>>> (so I can send by email)? I know I can do this with stand-alone fluid,
>>> but
>>> this requires shuffling and possibly duplicating some of the already
>>> existing logic.
>>>
>>> (To have all front-end functionality available, the script that creates
>>> the tasklist and email it can run as a front-end plugin, it doesn't
>>> necessarily need to run in cli-mode).
>>>
>>> Cheers,
>>> Loek
>>> ______________________________****_________________
>>> TYPO3-project-typo3v4mvc mailing list
>>> TYPO3-project-typo3v4mvc@**lis**ts.typo3.org <http://lists.typo3.org><
>>> TYPO3-project-**typo3v4mvc at lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
>>> >
>>> http://lists.typo3.org/cgi-****bin/mailman/listinfo/typo3-**<http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**>
>>> project-typo3v4mvc<http://**lists.typo3.org/cgi-bin/**
>>> mailman/listinfo/typo3-**project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>>> >
>>>
>>>  ______________________________**_________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>


More information about the TYPO3-project-typo3v4mvc mailing list