I search a way to randomize the order of tx_news article.
Is it possible without changing the NewsRepository.php?
If not, what would be the best way to add a random order?
News hasn't such possibility in its repository.
Assuming that you most probably want to use random order per each page view... I'd suggest to use ... JavaScript. Otherwise you will need to use non-cached content or page, which will influence your performance.
Of course you can create custom extension in which you'll be able to extend the repository class to add missing methods and render in your template, anyway in this case I also suggest supporting it with JS for better performance.
Related
TYPO3 is kind of new to me, but what I try (need) to implement is a multi-step-Wizard without a form, just a few buttons which lead to other buttons which then lead to specific pages. It should contain a back button and a step-indicator.
I first started to use html with vanilla JS but since the Wizard should support multi language I am a bit confused. Could it be better done with a own Extension? Use the Controller with Fluid?
Can you give me any tips on how I could tackle the problem in a good, TYPO3 manner way?
I tried it with vanilla JS and many if-else conditions. If button1 was clicked, set its style to none; and set the style of button2 to block; etc.
I tried it with a controller passing all the wizzard data to the view, use fluid to iterate and generate buttons.
But nothing seems to be a good solution. It all ends up with a bunch of DRY and hacky code.
Pretty much sounds like a "tab" element to me. You could go for the official introduction package or maybe the bootstrap package, that is the base for the introduction package.
https://extensions.typo3.org/extension/introduction
https://extensions.typo3.org/extension/bootstrap_package
With these packages as a base, you could easily implement something like this:
https://getbootstrap.com/docs/5.0/components/navs-tabs/#javascript-behavior
As you want that wizard in front end it is no specific TYPO3 problem.
There are elements in TYPO3 which are called 'wizard'. But that are forms to get some information to fill in a normal back end form field. That has nothing to do with the front end and the wizard you want.
For your solution it is necessary to analyse your requirements.
First: is the decision tree fix or may it vary sometime?
Second: how many decision levels do you have? how many endpoints do you have?
A small fix tree can be hardcoded.
If you expect changes or have lot of levels it might be better to have a flexible solution which gets called recursively.
This might include a hierarchical data structure to represent the decisions until you get an end point with an url to the final page.
The answer to the question about the amount of decisions might change the implementation:
If you only have a few decisions all data might be stored in the initial page and javascript only changes visibility or content of elements.
If you have a lot of data you might consider AJAX to get only small parts of data for the next decision from the server. repeating until you reach an end point with a final url.
In general:
have a data structure with something like:
ID
title/question
option1-text
option1-url / next node-ID
option2-text
option2-url / next node-ID
:
I need to build a block with data from (Symfony) Entity.
For example a carousel with last 3 item/record from database.
This block can appear in more than just a page.
I know that I can use a custom controller but is that the best technical choice ?
Do i need "Smart content" ? Read the doc but it's not clear
How i can do that ?
Thanks in advance.
Using a twig extension or a controller would definitely be the easiest way, because no sulu knowledge is required for that.
But the sulu way of solving that problem would be a custom SmartContentDataProvider. There are two main advantages of this method:
The content editor can further filter the result (in your case probably sorting and limiting)
The result is also displayed in the admin interface (Otherwise it would just be shown in the preview)
Our community is usually using our Slack channel or GitHub Discussions for support questions. Your questions will probably be answered a lot faster there, because there we can better track them.
I have contact persons' list and i want to display his detail(Email,Phone number,Address etc.)
Please give me simple example for the Address field.
I want functionality like the ACF(Advance custom filed plugin which provide in WordPress.
I am using Typo3 9.5.18 version.
I would use the extension tt_address https://extensions.typo3.org/extension/tt_address/.
Cheers,
Rachel
You can follow this:
How to create complicated content elements
or this:
How to create simple content elements
or the official documentation:
Documentation
Regardless what you choose, you need to be aware of the following: In order to create a custom content element you need time to understand how it works patience and do some experiments. Once you understand the process and create 5-10 elements, then all will come automatically to you :)
Best regards
I want to build a website, maybe similar to a movie database, where every page has, say, actors, director, year (it seems that Lektor can deal very well with such structured metadata), and I am thinking about how to realize internal links between pages on that site.
Say I have a text such as
just like in [his previous movie](link), he shows again ...
then I guess I could use the absolute path of the linked page as link target, but that makes me very inflexible with respect to changing URL structure. Can I somehow just use the ID of the target content?
Or, better yet, can I somehow automatically obtain the title of the linked page?
just like in his previous movie <<link:title>>, he shows again ...
Can I use the standard Markdown blocks for that or would I have to add some handcrafted database lookup logic?
if some contents will be changed in future. I think you can use the databag feature to implement it. you just modify the databg in case changed is need.
I am just wondering is there any plugin to create dynamic content for a page i.e something similar to a data repeaters in .net. To make it simple it should be a section that should contains 5 to 6 fields/property like
heading
heading 2
image
content - rich text editor
info
This must be in repeatable control so that the editor can add any number of these section a page and all these should be displayed in a single page.
Is there a plugin for the above functionality or what is the best way to achieve this.Any help would be greatly appreciated.
Thanks
Aneesh
You can achieve this without any plugins.
Create your repeatable section (containing the relevant fields) as a document type, and then use the multi-node picker in another document type to select one or many of the sections.
So for example, I could have a FAQs page (which uses a document type called "FAQs Page"), and I want to be able to add multiple question and answers to this page. I could set up a document type called "Question". This will contain two fields: Question and Answer.
On the "FAQs Page" document type, I would add a multi-node picker field called "Questions". This way, an author could select multiple "Question" nodes to appear on the FAQs page.
You would obviously need the code to output this, and also you would create a data type that inherited from multi-node picker, so that you could limit the selection to only Question nodes.
There is also the Repeatable Custom Content datatype which works well but does not support all data types. But it does support all the ones you need for your stated purpose (textstring, media picker, richtext area, etc).
You can find it here: http://our.umbraco.org/projects/backoffice-extensions/repeatable-custom-content I've used it a few times and it works really well in certain situations (e.g. where the items will not be shared across different pages of your site).
If you are sharing content components across multiple pages then #Digbyswift's solution is perfect.
I've always Digbyswifts method, but whilst looking for an alternate solution tonight I found this plugin, which is excellent for those situations where creating lots of widget nodes feels like overkill. It's licensed but the free older version is also available.
http://inaboxdesign.dk/blog/widget-builder-for-umbraco/