How can I pass an object to a specific view on a another page in TYPO3? - redirect

I have a simple controller with two actions:
listAction - shows a list of my objects
showAction - shows the detail page of an object
I am using a flexform for my plugin to define the detail page and can access to this via settings array in my controller. The standard view (list view) shows all my objects with a link to the detail page. This link will be generated by this fluid link action:
<f:link.action action="show" arguments="{example: example}" pageUid="{pageId}">details</f:link.action>
The generated links looks as follows:
details
I think that's ok and the redirect to the correct detail page is also working, but it seems that the show view is not showing up, because it will not be rendered. My showAction and my Show.html looks as follows:
Show.html
<f:layout name="Default" />
<f:section name="main">
<h1>Detail page</h1>
<f:debug>{example}</f:debug>
</f:section>
showAction:
/**
* Shows the details page
*
* #param \Fox\Example\Domain\Model\Example $example
* #return void
*/
public function showAction(\Fox\Example\Domain\Model\Example $example) {
$this->view->assign('example', $example);
}
So it seems that the action of the fluid link action viewhelper will be ignored. When I remove the pageUid="{pageId}" from the link action above I can see the show view, but then I will be not redirected to the correct detail page.
What am I doing wrong?
UPDATE
Ok it is working when I include the frontend Plug-In to the detail page, too. Is there a way to pass up the double include?

Ok it is working when I include the frontend Plug-In to the detail page, too. Is there a way to pass up the double include?
No, it is supposed to work like this - a plugin has to be present on a page if it should be rendered there. This presence can be indirect though:
You could reference the plugin (using a record of type "Include Records", or some reference mechanism from an extension).
You could include it using TypoScript (frequently used if it should
be on many pages).
Anyway, if there is no specific reason to have separate pages in the page tree for detail and list view, just put them on one page using the same plugin.

Related

Getting the page title from the new PageTitle

I'm looking for a way to get the page title set via the new PageTitleProvider API to display it inside a FluidTemplate.
In one of our TYPO3 installations, the page title is used as title, displayed on the page itself. The main PAGE object is set up to render a FLUIDTEMPLATE object. I've implemented the examples on the new PageTitleAPI in the documentation, https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/PageTitleApi/Index.html into my extensions and that works just fine for the tag.
However, within the page itself, the title set in the page is still displayed, not the title I've set in my extension.
I've figured out, that I can instantiate the PageTitleProviderManager, but getTitle still resolves to the page name, not the title I've set, most likely because this object is resolved before the PageTitleProviders are set up by the extensions.
$pageTitleProviderManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\PageTitle\PageTitleProviderManager::class);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $pageTitleProviderManager->getTitle() );
// -> outputs the page name, not the title custom page title
Is there a way to resolve the page title after all Providers are processed and display it in a fluid template?
I also assume it depends on order of execution. so you need to build an order where your plugin is executed before the page title is rendered in the page template.
nowadays most integrators use the f:cObject viewhelper to render the content with lib.content. that means the content (and your plugin is rendered very late), as the page title is probably rendered before any content in the page template (independend whether you use template variables from the page template or a viewhelper which executes PHP or typoscript in the moment of the rendering.
Here you get a hint how to change the order:
try to render the content (including plugins) into a fluid-variable with the page templating ( e.g.:
page.10 = FLUIDTEMPLATE
page.10.variables.content < styles.content.get
) and try to get the page title when the page fluid is rendered: use a viewhelper to get the page title when the initial FLUID variables are already computed.
of course you also can define a FLUID-variable for the content in the page FLUID template before accessing the page title by viewhelper:
<f:variable name="content"><f:cObject typoscriptObejctPath="lib.content" /></f:variable>

TYPO3 7.6 TCEFORM Custom Layouts doesn't work

I upgraded TYPO3 6 to 7.6.x and now I can't choose custom layouts in the backend for any content elements in the backend. I only see the default options like "layout 1, layout 2". The reason is obviously that my TCEFORM addings doesn't work..
The following typoscript won't have any effect in a ext-template of a page or in the root setup.ts:
TCEFORM.tt_content.layout.altLabels.2 = Test
TCEFORM.tt_content.layout.removeItems = 2,3
TCEFORM.tt_content.layout.addItems.5 = New Item
I know the problem description is a bit inaccurate. But I don't see the relevant infos which u need. Can u give me an advice what I have to check? Are there known conflicts with extension like fluidcontent, css_styled_content or so?
TypoScript configuring the back end is (though TypoScript by syntax) often called TSConfig and can be added either in page records or via user settings but never in extension templates or similar.
Configuring TCEFORM is usually done in page properties. To add, open page properties of your root page (or the topmost page of the subtree you want to configure) and add your code there.
As in front-end TypoScript you can swap your code to external files.
You need to add this typoscript on Root Page in Page TSconfig.
Edit root page properties and add your typoscript in Resources tab in Page TSConfig section like below image, so it's work fine.

News 3.0.x - how to keep overwriteDemand

I have setup the TYPO3 news extension (not tt_news) to show a date menu with archived news items. From the archive menu, you can go to the list-view with all news for a given month. From the list-view, you can go to the details-view, to actually view the news item. In the detail view, I have configured the list-view as PageId to return to.
I think this is a standard setup and has nothing special.
The link from the date-menu to the list-view contains the GET parameter "overwriteDemand", which adds the month and year to the demand of the list view, so only the news articles for the given month/year are shown. Actually this GET parameter is not kept, when linking to the detail-view (with the n:link viewHelper) and therefore also not given back to the list-view, when I go back to the list-view from the detail view. The list-view therefore shows all news records after I come back to the list view from a detail-view.
Adding a javascript.back() button is no solution for me, since I want to use real links.
Am I missing something or is this a missing feature?
There are two ways to handle this.
the first option is, to edit the templates and add the parameters to the links using the arguments parameter of f:link.page (or something similar).
Second option is, create a new extension-template in the tree of the single page and add some typoscript, which keeps the parameters in the rendered link. The config name ist called linkVars and is descriped here: http://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars
tx_news uses <f:link.page in his templates. I just checked on github tx_news to see if it changed, but it still looks the same.
This is how tx_news generates the backlink:
<f:if condition="{settings.backPid}">
<!-- Link Back -->
<div class="news-backlink-wrap">
<f:link.page pageUid="{settings.backPid}">
<f:translate key="back-link" />
</f:link.page>
</div>
</f:if>
So it looks like the overwriteDemands are not kept. I think it would be a really good sugestion to the tx_news Dev-Team to keep the overwriteDemands in the backlink.
You have the {overwriteDemand} as an object in your template, so for now you can use something like this:
<f:link.action pageUid="{settings.backPid}" arguments="{overwriteDemand:{year: year, month: month}}">
First, you have to write a bit of typoscript to store the pagination currentPage :
lib.currentPage = TEXT
lib.currentPage {
value = 1
override.data = GP:tx_news_pi1|currentPage
}
In the paginated news list page, give the currentPage value to all links pointing to detail page :
<n:link newsItem="{newsItem}" settings="{settings}" configuration="{additionalParams:'&tx_news_pi1[currentPage]={f:cObject(typoscriptObjectPath: \'lib.currentPage\')}'}">
Read more
</n:link>
Then in the detail page, finishing by building back link to previous paginated list page :
<f:variable name="currentPage"><f:cObject typoscriptObjectPath="lib.currentPage"/></f:variable>
<f:link.page class="btn btn-xs" pageUid="{settings.backPid}" additionalParams="{'tx_news_pi1[currentPage]': currentPage}">
Back
</f:link.page>
;-)

TYPO3 extension "news": Getting "Detail View" URL

I have started using the TYPO3 extension "news" and I would like to create in the LIST VIEW a "Facebook Like Button" for the Detail View of each enty. For this I need to fetch the URL of the DETAIL VIEW, not the whole <a> tag. How can i do this?
I tried this, but it didnt work:
<n:link configuration="{returnLast: 'url'}" newsItem="{newsItem}" settings="{settings}">
Link to detail page
</n:link>
It uses Fluid Templates, which I'm completely new with, so I don't know how complicated this actually is.
I found the solution. parameter uriOnly:
<n:link uriOnly='1' newsItem='{newsItem}' settings='{settings}'></n:link>"

seam redirect page

I use seam to manage a viewer page.
In my page I have a div (iframe) where an html page is displayed on particular conditions.
In particular I need to change the page displayed in this div deciding from serverside.
I try to explain me better:
on commandButton click the control is passed to server (using an action). This action method set some things and know what page should be loaded after (or none in some cases).
when the control come back to the caller page, the new page setted by the action method must be called (it uses the things specified by the action method).
How can I do this?
NOTE: the oncomplete tag is not usable in this context because I have many commandButton and it is called everytime I click on one of the commandButtons.
I'm not completely sure what your trying to do.
Are these pages rendered dynamically?
You can generate HTML from the serversite and just output it using a <h:outputText id="iframediv" value="#{controller.htmlparameter}" escape="false" />
An <a4j:commandButton reRender="iframediv"> could then reRender this dynamically generated page.
If the pages are defined statically you could include them like this.
<rich:panel id="iframediv">
<a4j:outputPanel rendered="{controller.page1}">
<ui:include src="page1.xhtml" />
</a4j:outputPanel>
<a4j:outputPanel rendered="{controller.page2}">
<ui:include src="page2.xhtml" />
</a4j:outputPanel>
</rich:panel>
The controller's page1 and page2 parameters should be booleans and set by the action you've called.
Solved using javascript activated only when a particular property is present over the serverside.