Why can't I access my extensions' settings on the frontend? - typo3

Trying to access a few settings that I've created in my constants.txt file. It looks like this:
plugin.tx_my_ext {
settings {
# cat=plugin.tx_my_ext/urgences; type=boolean; label=Activer les urgences
activerUrgences = 0
}
}
Then in my setup.txt file I have this:
plugin.tx_my_ext.settings.activerUrgences = {$plugin.tx_my_ext.settings.activerUrgences}
Any reason why I wouldn't be able to access my settings using {settings} in my Fluid layout?
BTW, my extension name does include an underscore _ between the words. I have tried removing the underscore, then removing the tx_, and then a combination of those two.
Any help would be appreciated!
Thanks

For ext with key my_ext it should be plugin.tx_myext.settings
Make sure that you 'Included static from extension' in your TypoScript Template. If your ext is not available on the list add it in ext_localconf.php like that:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'MyExt');
Do not forget to clear System cache and FE cache at least million times ;)
Use TypoScript object browser to check if on given page your plugins TS is still available (maybe something resets TS in meanwhile:
Finally make sure that you don't clear $this->settings array within your controller, if you do manipulate it for any reason assign it to the view again before view rendering,like that:
$this->view->assign('settings', $this->settings);

Related

How to get the Log In Form on every page? (for example in footer) Typo3

Is there a way to get the Log In Form for Frontend User on every page? I would prefer the footer.
And if someone is logged in you can see the Log Out Button.
Is this possible without an extension?
You can copy the default felogin output to wherever you want on your template. For example use lib.login, copy the plugin.tx_felogin_pi1 into it, change the template and you're fine.
lib.login < plugin.tx_felogin_pi1
lib.login.templateFile = path/to/your/template/file
More you can see in the official documentation: https://docs.typo3.org/typo3cms/extensions/felogin/8.7/Configuration/Index.html
In general there are three options to include a CE (e.g. the Login-form) on all pages:
use typoscript to generate the CE. Normally the CEs are defined in tt_content, from where you could copy the base configuration and adapt it. For some plugins you also find a complete configuration beyond lib (for newer extensions there you only find the settings). All the configuration must be done in typoscript.
use typoscript to render the content of a special page/ column. In this variant you have a special page only for content referenced somewhere else. Advantage: you could configure the CE in the usual way. Try to avoid referencing CEs by uid as an editor might disable or delete the current element(s) and insert a new one which would not be rendered.
use a special column in your root page and inherit the content to all subpages. Advantage: you could change the inherited content easily on each page (if this column is available in the current backend layout).
example for 3:
variables {
footer_content < styles.content.get
footer_content.select.where = colPos = 15
footer_content.slide = -1
}

Custom tags in TYPO3 content

new here, and also new to TYPO3.
I need to put something like [imagebox, title='box1'] into content editor and that will be replaced by a text and image with some javascript effect (text and image are managed in the DB elsewhere, the tag is just for the placement in the page).
I've read that TYPO3 has a mechanism for adding custom tags and I managed to make them accepted in the RTE.
I tried instead of [imagebox..... to use
<imagebox>box1</imagebox>
with something like this (copied from web):
tt_content.text.20.parseFunc.tags {
imagebox < lib.parseFunc.tags.link
imagebox = TEXT
imagebox.value= replaced
# imagebox = PHP_SCRIPT
# imagebox {
# stripNL = 0
# Pass a parameter from Typoscript to a PHP script:
# UID of the page containing the SINGLE view of tt_news
# id_singleView = 18
# Call the PHP script
# file = fileadmin/scripts/imagebox_parser.php
# }
}
lib.parseFunc.tags.imagebox < tt_content.text.20.parseFunc.tags.imagebox
should be able to replace content between tags.
I've commented call to php function just tried to get a text replacement for starters.
I've put that in the main root template Setup, but nothing is replaced.
I've also tried other examples from the web with no success.
Did anyone have situation like this?
Are there better approaches for that in TYPO3? (I'm using v7.6.23)
Any suggestion or hint is appreciated.
EDIT: using FSC on textmedia element
I think your examples are outdated. (the object PHP_SCRIPT is obsolete for a long time)
You might have a look at the documentation for your TYPO3 version:
https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/Parsefunc/
you also need to enhance the parsefunc where you need it. That can depend on:
CSC or FSC?
which kind of content element (CE) do you use? (be sure to enhance the rendering of that CE)

Order of Constants TS in Template Analyzer

i'm struggeling with the order of typoscript in constants. I've a provider extension holding all the templates and files for the site. Typoscript ist used in external files, i don't want to store typoscript in the database. I use typo3_forum ext and want to modify the templates to customize it. But when i put the ts for the view like:
plugin.tx_typo3forum {
view {
templateRootPath = EXT:provider/Resources/Private/Templates/Forum/Standard/
partialRootPath = EXT:provider/Resources/Private/Partials/Forum/Standard/
layoutRootPath = EXT:provider/Resources/Private/Layouts/Forum/Standard/
}
}
these values will be overwritten by the typo3_forum ext itself, cause the constants of typo3_forum ext stands in the templateAnalyser hirachy under my provider extension.
Sure storing the above ts in the constants field of my roottemplate solves the problem but is there no solution for external fiels to sort?
I've tried:
plugin.tx_typo3forum.view.templateRootPaths.100 = EXT:provider/Resources/Private/Templates/Forum/Standard/
but this doens't work, the ext uses the default template in that case.
Thanks for your help!
Cheers Mark
Put your line
plugin.tx_typo3forum.view.templateRootPaths.100 = EXT:provider/Resources/Private/Templates/Forum/Standard/
in the setup, not in constants.
You can move the path to constants like
Constants:
plugin.tx_typo3forum.view.myTemplateRootPath = EXT:provider/Resources/Private/Templates/Forum/Standard/
Setup:
plugin.tx_typo3forum.view.templateRootPaths.100 = {$plugin.tx_typo3forum.view.myTemplateRootPath}
If using TYPO3 version 8, take a look at https://forge.typo3.org/issues/75862. There is a bug regarding the fallback for template paths. The issue has been solved already and is targeted for version 8.4
The order of TS appearing in the template analyser simply reflects the order in which the files are loaded.
If you are already using a provider extension for your TypoScript and don't put any TS statements in the database (which is a good practice) you can go one step further and put no extension TS in the database at all (not even include static templates in the template record).
Just include the TypoScript files that you need in your provider extension with <INCLUDE_TYPOSCRIPT and you have complete control of the order of things.
In the database you have to put just one line in constants and one in setup, each of the including from your provider extension. This will also make you less dependent of the database because if you include a new file it is just loaded and no actions are needed in the actual template record in the backend.

Manage hierarchy / enforce priority of TS-templates

Well, there is actually another guy with exact the same problem. But until today, they didn't come up with a solution, that's why I'm asking it once again.
My entire TS is included by an extension in TYPO3 7.6.8. This works fine except with indexed_search. The TS inside my resources EXT get overwritten by the indexed_search default TS.
This is the order of the TS inside the Template-Analyzer:
SYS: TYPO3_CONF_VARS:FE:defaultTypoScript
EXT:fluid_styled_content/Configuration/TypoScript/...
... a bunch of other third party extensions ...
EXT:indexed_search/Configuration/TypoScript
EXT:templates_ext/Resources/Private/TypoScript
extbase
fluid
extensionmanager
belog
beuser
felogin
indexed_search
sys_note
realurl
So #7 is the extension which includes all my TS but it gets overwritten by #14. The only way to configure the indexed_search is inside the setup of the page template (which comes after all those above). But I want to avoid that to keep things clean.
Is there a way to prioritize a certain TS so that it doesn't get overwritten?
Open the TypoScript record, switch to the tab "Includes", at the bottom you will find the field Static Template Files from TYPO3 Extensions:. Select the value Include before all static templates if root flag is set.
Try putting the TS from your template extension inside the root page Setup field like this (adjust the path if necessary, your example says Resources/Private/TypoScript?):
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:templates_ext/Configuration/TypoScript/setup.ts">
This should make sure that it is included AFTER all the other includes (I assume you included those via the includes tab?)

Typo3: classes for elements

I have 3 different kinds of in my website, and I want to give be able to give different classes from the backend using the RTE from the Text Element. It should look like this:
<ul class="type2">
....
</ul`>
I thought I should use one of the 3 boxes from the RTE, probably "blockstyle", but im not sure how to add new options to this dropdow. Can someone please help me? Thanks!
The standard RTE editor (rtehtmlarea) populates the class list by parsing the CSS file that you set for it so all you need to do is to define ul.type2 in that CSS file. See the manual of the extension and search for contentCSS property. Example:
RTE.default.contentCSS = fileadmin/template/rte.css
Note that you might have to set it also for each table, e.g.:
RTE.config.tt_content.bodytext.contentCSS = fileadmin/template/rte.css
This depends on your configuration and whether you already have default settings (RTE.default) copied into other configurations. See Info -> [page] -> Page TSconfig -> RTE. for your current settings.