[TYPO3-mvc] get current CE uid into fluid view
Sebastian Schreiber
me at schreibersebastian.de
Tue Apr 10 13:46:35 CEST 2012
Hi Frank,
either you write a dedicated ViewHelper or you just call this in your
controller and assign the uid to the view:
$cObj = $this->configurationManager->getContentObject();
$currentUid = $cObj->data['uid'];
$this->view->assign('currentUid', $currentUid);
If you would like to create a special ViewHelper have a look at the Class:
Tx_Fluid_ViewHelpers_CObjectViewHelper
Hope that helps.
Am 10.04.2012 13:38, schrieb Frank Gerards:
> Hi Henjo,
>
> thx - the object that should be "parsed" to the typoscript RECORDS object is the current Content-Element the fluid view represents.
>
> Doesn't a fluid view "know" which content-object it represents when rendered ? At least on a typoscript level, which is parsed at page render time, that uid should be present, but isn't when called from a fluid view it seems.
>
> In general, an extbase extension represents a prototype of i.e. a plugin on a TYPO3 page and for each instance of that plugin a tt_content entry is written in the DB.
>
> I need exactly the uid of that tt_content entry in my Typoscript object.
>
> Hope that cleared the subject a bit. I don't need anything "out of" the fluid view, but simply the current uid of the cObj on typoscript level...
>
> Thx 4 the link,
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Henjo Hoeksma
> Gesendet: Montag, 9. April 2012 15:50
> An: TYPO3 v4 MVC project
> Betreff: Re: [TYPO3-mvc] get current CE uid into fluid view
>
> Hi Frank,
>
> current is empty because you don't parse anything to it.
>
> You could use the data property of the cObject viewhelper to parse a content object through. That will be accessed by the current property.
>
> See [1] for some usage of cObject from within Fluid.
>
> http://www.t3node.com/blog/combining-fluid-viewhelpers-and-typoscript-in-typo3-5-basic-examples/
>
> 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, Apr 5, 2012 at 13:42, Frank Gerards<F.Gerards at esolut.de> wrote:
>
>> Hi list J,
>>
>>
>>
>> I need the uid of the current content-element the fluid view is
>> rendering as information inside a fluid view.
>>
>> My idea was to get it via a Typoscript Object (of type RECORDS) and
>> insert it via<f:cObject ...>.
>>
>> So in typoscript I made my object like:
>>
>>
>>
>> lib.somelib = RECORDS
>> lib.somelib {
>>
>> tables = tt_content
>>
>> source.current = 1
>>
>> conf.tt_content = TEXT
>>
>> conf.tt_content.field = uid
>>
>>
>>
>> }
>>
>>
>>
>> By source.current = 1 I thought to get the current uid of the content
>> element, much like it is done in TemplaVoila FCEs.
>>
>>
>>
>> Sadly, this construct returns nothing. If I change source.current = 1
>> to source =<absolute-dataset-ID> it works perfect.
>>
>>
>> My question: Isnt a fluid view embedded in the usual TYPO3 rendering
>> context where I .current = 1 works ?
>>
>>
>>
>> Greetz,
>>
>> Frank
>>
>>
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
>> vc
>>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
--
Sebastian Schreiber
(Medieninformatiker B.Sc.)
(TYPO3 Certified Integrator)
Schanzenstraße 27, Schlosserei 4
D-51063 Köln
T 0221 677 88 541
M 0176 431 05 790
Skype schreibersebastian.de
me at schreibersebastian.de
www.schreibersebastian.de
Steuernummer: 217 / 5269 / 4675
More information about the TYPO3-project-typo3v4mvc
mailing list