Context and $GLOBALS['TSFE']->id etc - typo3

Since Typo3 v10, one should use the context API instead of $GLOBALS['TSFE'].
I read this (https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Context/Index.html), but can not understand how to come from here to GLOBALS['TSFE']->id...
I simply do not understand how...
Can someone post an example how to get $GLOBALS['TSFE']->id?

In all current TYPO3 versions $GLOBALS['TSFE']->id is still available and the way to go in most cases.
There has been a change in where it's initialized though, so it might be it's not available (anymore) in your case. If that's the case you'll have to add more information about where you want to use it.

Related

AEM-6.4 Original Value of sling:resourceSuperType for /libs/foundation/components/redirect

I have accidentally make changes to the sling:resourceSuperType value of /libs/foundation/components/redirect in CRXDE. I have tried to google from AEM site like https://www.aemcomponents.dev/ to get the answer, but still no avail.
I would like to know the original value that set to the sling:resourceSuperType. It will be good if someone can share the value here, or will even better if able to share any other site and guide that can get the original properties of each AEM components.
foundation/components/page is the sling:resourceSupertype for /libs/foundation/components/redirect
(The 'redirect' component refers to a page. Hence, its super-type is 'page')
Also you can always copy your jar with a new name and port and extract it. It will create a vanilla system and there you can check it.

Are pibase extensions still working in TYPO3 8?

I have to migrate TYPO3 6.2 websites to 8.7. Some websites use custom pibase extensions, do I need to redevelop them with Extbase ?
All previous answers have been correct but some words from a TYPO3 core team member: There are no plans to drop the support of "pibase" in the core. It is absolutely ok to use that API even though it does not provide much help to developers.
However I recommend to use at least fluid standalone to be able to create nice templates without all those ### stuff.
you don't need to redevelop these extensions, but you might need to change the call to core functions.
In 6.2 you still could use the old class names like t3lib.
These class names are available only with compatibility layer (together with a lot of delay).
For the future you need to use namespaces (and the correct new classes). You also should use namespaces for your own classes.
Depending on your used functions you might need to replace some calls with the newer functions as some functions got deprecated meanwhile.
You don't need to redevelop these extensions.
Just you need to change some TYPO3 core function like t3lib_div t3lib_BEfunc t3lib_parsehtml t3lib_extMgm and more..
Please see complete example here : See more details

Can I use TYPO3's RTE in a front end plugin?

I have a custom extension, and i need to use some form of text editor in the front-end. According to the documentation, it should be possible, but the documentation and tutorials seem to be deprecated. I think this is not available in typo3 7.6 :
require_once(t3lib_extMgm::extPath('rtehtmlarea').'pi2/class.tx_rtehtmlarea_pi2.php');
Can it be done somehow or do i need to install another extension for this, maybe just a viewhelper? Thank you in advance.
I did lots of researches trying to use the rtehtmlarea in the FE, but failed. Then, I realized I could use any RTE, as they are nothing but js+css. All I need is to render the contents with RTE.FE, like how the BE does, and save the result into the database, which is all I want. I have already done this in many sites, using standalone tinymce, and it works great. So, I think maybe you could try this solution.
To be honest, that feature worked only in theory and never in reality. Use an RTE like ckeditor or whatever fits best

TYPO3 - Migration from RealURL to CoolURI

I have a big TYPO3 instance that exists for ages. All the time the webpage used RealURL but now we want to migrate to CoolURI because we have better experience with this. Now the problem is that all old links shall be available even after switching the URL extension.
The CoolURI documentation states
Migrating from RealURL
The field Speaking URL path segment (tx_realurl_pathsegment) is kept with its values, but make sure it's listed in the element.
I got the tables tx_realurl_pathcache and tx_realurl_uniqalias besides some other tables like redirects, etc. But I don't really understand the function and differences of these two tables and can't find any indepth documentation on this. So I'm a bit afraid right now that I have to reverse engineer the whole extensions and then write a script which exports all the old URLs and imports into the new CoolURI tables. Because we also use tt_news and these URLs have to work, too.
So does anyone have some experience with this? Does CoolURI automatically handle everything and the old links are still valid or if not maybe someone could give me a detailed explanation for all the RealURL tables in the database?
I wouldn't migrate if there is no really important reason (like ie. missing feature). To make sure that you'll be able to generate all links properly and then map them into CoolURI you'll need to learn RU logic anyway.
Reason: RU generates links on the fly - if it's required, and then caching it in the tables, other tables stores links to common pages and other for extensions. You would need to just write custom extension which will visit each page, to make sure that RU cached every possible link and then rewrite all results into for an example list of redirects. IMHO it's not worth of wasting time.
Note, I don't want to say that CU is bad :) actually I don't know it. I want to just remember Voltaire's most famous words: "the better is an enemy of the good"

Google like autosuggest with Solr

I'm currently using Solr with Terms Component and Jquery Autosuggest which works quiet good. However, this construct is limited to one autosuggest word (it autocompletes only the first word). Is it possible to implement a Google like autosuggest with multiple words/terms so i can autocomplete multiple words?
I just wrote a blog post about different ways to make auto complete suggestions with Solr. It's basically a comparison of some different strategies, check it out, it might help.
If you want to make multiple terms suggestions, it turns out you should use, as already mentioned in the other answer you got, the Suggester component available in Solr starting from the 3.1 version. Since it has some limitations, you can also have a look at the ShingleFilterFactory, which generates token NGrams. It creates combination of tokens as a single token, that's useful to suggest multiple words.
You can also use SpellCheckComponent for better auto complete suggests.
See http://wiki.apache.org/solr/Suggester for details.
Edit:
Refer here for solr5 and above
Check this out, it might help
http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/
I worked out the same task, finally got solved using TermsComponent with multiple fields. check this link. http://lucene.472066.n3.nabble.com/auto-completion-search-with-solr-using-NGrams-in-SOLR-td3998559i20.html