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>
;-)
Related
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>
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.
after couple of hours of trying I am absolutely clueless about how customize the way Orchard displays blog posts in lists and individual view.
IEnumerable<object> blogPosts =
Model.ContentItems.ContentItems;
<ul class="content-items">
#foreach (dynamic post in blogPosts) {
string title = post.Title;
ContentItem item = post.ContentItem;
<li class="content-item-summary">
#Html.ItemDisplayLink(title, item)
</li>
}
</ul>
This is my code for displaying blog posts in list. I am only able to show title surrounded with hyperlink. I cannot figure out, how can I access Body text, Tags or even image added as field. #Model.Body.Text and various other does not work.
I must be doing something very wrong, because it cannot be that hard, can it? I previously created some sites on Umbraco and was able to accomplish this very easily.
I want my list to contain for every post title (done), then excerpt from body and image from Media Library Picker Field. It shows everything automatically when I open individual articles.
I watched Pluralsigh fundamentals, read documentation, experimented with shape tracking...
Thanks for any help or pointing in the right direction.
You can access the other parts like so:
ContentItem item = post.ContentItem;
var bodyText = item.As<BodyPart>().Text;
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>"
Im new to umbraco. im trying to display certain section of one template inside another template.
for e.g.
1) i have Product page, which lists all the products and few description about them.
2) now i want to show this content to my home page also. i dont want to copy and paste code from product page to home page..as this would require me to do the same if some changes come on product page.
Also, Product page contains child nodes, which automatically displayed by Macro.
i just want to display Product page contents to my home page.
Thanks in advance.
You simply need to add a new macro that will display the product page contents you need and then add it into the homepage template.
Doing it as a razor scripting file would be something like (where 1111 is your product page node id). If you use ucomponents you could use uQuery.getNodeByUrl or some other nicer helper method, but this code should work out of the box:
var productPage = #Model.NodeById(1111);
<div>
<a href="#productPage.Url">
<h4>
#productPage.copyHeadline
</h4>
</a>
#if (!string.IsNullOrEmpty (#productPage.copyBlurb.ToString ()))
{
#Html.Raw(#productPage.copyBlurb.ToString().Substring(0, 200) + "...");
}
</div>