Hi what is the best practise to limit the result of findAll in TYPO3?
I want to do it in controller.
Thanks in advance.
You can change the query in the controller as well:
$this->myRepository->findAll()->getQuery()->setLimit(4)->execute();
Better do it in repository by overriding findAll() and setLimit() for the query. Or use the viewHelper <f:widget.paginate ...> in template.
Related
I want to create a link to an external page with parameters via the f:link.typolink-ViewHelper. The ViewHelper creates the link but without my parameters. I've used an example from the TYPO3 documentation (https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Link/Typolink.html). I'm using TYPO3 9.5. Do I need some further configuration?
<f:link.typolink parameter="www.test-link.de" additionalParams="&u=b">
Linktext
</f:link.typolink>
The correct way to write this would be:
additionalParams="{name: 'value'}"
You can even combine multiple parameters like this:
additionalParams="{name: 'value', anotherName: 'anotherValue'}"
It can work without additionalParams
<f:link.typolink parameter="www.test-link.de?u=b" >
Linktext
</f:link.typolink>
FYI, additionalParams was not working of me as well. So I did the above
Update:
There is documentation error at https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Link/Typolink.html
Way to do it is as suggested by #Scopestyle
im refactoring a decent sized TYPO3 project and have to refactor the part with the methods
$eIds = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'selected_contacts', 'sDEF');
what is the new approach for extbase to fetch values from a flexform? having a really hard time finding the correct solution.
help is much appreciated
Rename the XML-Tags to settings.name inside your flexforms and use:
$this->settings['name']
Check this for an example: enter link description here
I have no idea how I have to improve my listview in the backend module with a search or a filter (for only the records in the folder). That's why I don't have any code to show.
I actually have a list of all records and now I have to optimize this view for the administrator. This means I'd like to search over some columns and a filter to show only the records with the selected categorie from the dropdown.
I hope that someone can give me a hint, link or example how to realize something like that. I think it is a general thing how I can manipulate or integrate own php scripts or whatever.
Thanks for your help guys
Cheers
You can implement an filter method to you repository. Submit the form of filters to your index action an instead of $this->myRepository->fetchAll() make an function with filter: $this->myRepository->fetchByFilter($categorie).
In your repository class it looks something like that:
function fetchByFilter($categorie) {
$query = $this->createQuery();
$matching = [
$query->containts('categories', $categorie)
];
return $query->matching($query->logicalAnd($matching))->execute();
}
There might be such feature soon in the TYPO3 core (version 8.x), however doing such thing is not really easy.
An easier approach would be to use a custom backend module and render the content of the list module there again including the filter. You can take a look how I do it with the TYPO3 extension newssince version 5.0.
The contoller: https://github.com/TYPO3-extensions/news/blob/master/Classes/Controller/AdministrationController.php
Adding the filter for the record list: https://github.com/TYPO3-extensions/news/blob/master/Classes/Hooks/Backend/RecordListQueryHook8.php#L76
Hope that helps!
I have created a custom template for paginations. But I want to display a count of all news articels and so I'm looking for a solution to pass a variables to the pagination. I don't want to build a custom viewhelper, I want to stick with the original PagionationViewhelper.
Maybe have anyone a idea?
Make the counting with a cObject like lib.newscount
then you pass that with the cObject Viewhelper like:
<f:cObject typoscriptObjectPath="lib.newscount"></f:cObject>
TYPO3 6.1
I wanted to call some function on opening of extbase news list view.
For example, if the url to list view contains tx_news_pi1[overwriteDemand][tags]=1, then I want to update that "tags" count by 1 in database.
How this could be possible ? Any help ?
And if You will just extend the class You need ?
config.tx_extbase {
objects {
Tx_FooExt_Controller_OriginalController.className = Tx_MyExt_Controller_OtherController
}
}
It looks like easiest way.
References
http://blog.sebastiaandejonge.com/articles/2013/june/11/class-extension-in-extbase/
http://lists.typo3.org/pipermail/typo3-english/2011-December/078458.html
The easiest way would be to just add a simple user function by TS and do it there