ext_conf_template - how to use settings in root.ts - typo3

I develop TYPO3 extension. And I have file ext_conf_templates with my settings. How do I use this settings in the typoscript, root.ts ?
# cat=Template_einstellung/101/0104; type=options[nein=,ja=noborder]; label=remove bottom border (only with transparent use)
template.border =

In your ext_localconf.php add below code.
$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]);
$border = $conf['template.']['border'];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants("
plugin.tx_yourextensionkey.template.border = $border
");
Now, anywhere in your typoscript setup you can access your border variable with {$plugin.tx_yourextensionkey.template.border}. You can name this variable as you like but best practice is to use plugin and extension name prefix to make it unique across installations.
Above works for TYPO3 CMS version 8.7. I think it´s the same routine all the way down to version 6.2 but I´m not 100% sure.
You can verify that this works with the Template backend module. In the main select box select TypoScript Object Browser. Make sure that the browser select box says Constants. Now you should be able to find your new variable.

Related

TYPO3 REST Extension setup

I'm trying to setup the REST-Extension v2 in TYPO3 8.7 following this tutorial. I included the 2 templates called Virtual-Object-Page and Virtual-Object-Content in my template. I made a new extension using Extension Builder 8.7 from Github with a simple model. I installed the new extension and made some Instances of my model in the List View on my start page. In the Typoscript of my template I added:
plugin.tx_rest.settings.paths {
1 {
path = me-kinder-child
read = allow
write = allow
}
}
Me is the Vendor, kinder my extension key and child is my model.
When I'm calling http://localhost/rest/ I get The requested URL /rest/ was not found on this server.
What am I missing?
The path in the setup is explained being possible with several options, so perhaps try different configuration, possible is also all.
I don't see a fault in your setup, so the fault might be related to the server-file .htaccess or the extension realurl respectively the combination of both perhaps.
If you try it already with realurl or cooluri then disable that to get it running without first.
The htaccess file you can disable first too and enable it later again to adjust all requirements to each other.
The problem was not about RealURL was missing in any way. I just did not clear a cache that got cleared while installing RealURL. I guess that the "Clear all caches"-button in the Install-Tool would do it too.

Typo3 6.2 Module: How to add an action to an existing module

I need your help!
Goal:
A Typo3 6.2 module should be extended with a button to delete all user data inserted. By default it is only possible to delete data one-by-one.
Conditions:
no changes in the core data of the original module allowed
I tried the following:
1. Extending the controller with XClasses & adding a new method cleanupAction
Problems with that:
cleanupAction is not allowed
Action would have to be added to ext_tables.php of the original module. But this is not allowed.
2. An own backend module:
Problem with that:
An entry in main nav in backend is generated, which is not desired and not needed.
Do you have any ideas how to tackle the problem? I only want to have an action, which can be called in the backend, without having a main-nav entry.
Thanks for your help!
Set up your own extension, containing a controller, some typoscript setup and a template.
The typoscript is used to change the template of the original backend module to your own version of the template:
module.tx_originalextension.view.templateRootPath = EXT:my_new_extension/Resources/Private/Templates/
Copy all templates from the original extension to your new extension. Add the new "delete all" button where you need it and link it with your new extension controller -> deleteAllAction. Of course, you need to implement the deleteAllAction in your controller.
In your controller, inject the original repository from the original extension, and use it to delete the data.
Remember to check the links in the copied templates. They need to point to the original extension, so add "extensionName" to any f:link.action calls expect the new "deleteAll" link.

Debug portal_skins order for Dexterity content types

We have one Plone site (4.3.x) using TinyMCE version 1.4.3, but we found that we should have the version 1.3.18 instead for this Plone version.
So I:
Uninstalled the TinyMCE package ( manage / portal_setup / import / Remove TinyMCE profile ).
Pin buildout version to 1.3.18 and run buildout.
Reinstalled TinyMCE package ( same procediment, but select TinyMCE install profile).
After that I notice that:
For default Plone content types it worked fine.
For the new dexterity content types defined in this Plone Site it didn't work. It load just a textarea with html into it instead of load TinyMCE.
I did many tests on this, and what I can see is that my content type should use wysiwygEditorBox macro from this template Products/TinyMCE/skins/tinymce/tinymce_wysiwyg_support.pt but instead it is using this template Products/CMFPlone/skins/plone_wysiwyg/wysiwyg_support.pt.
I tried to change order of portal_skins but it just affect Archetypes types, not Dexterity types.
What step should I do next? is there any better way to debug it instead of adding <span> tags with debug messages?
Looking in the parts/omelette directory shows the following in plone/app/form/widgets/wysiwygwidget.pt (line 21)
support_path string:nocall:here/${editor}_wysiwyg_support|here/${editor}/wysiwyg_support|here/po
My guess is that ${editor} isn't set right (ie to tinymce) so the above line is falling back to search for the wysiwyg_support.pt template.

In TYPO3 6.x, how to get defaultJS, when config.disableAllHeaderCode is enabled?

I set config.disableAllHeaderCode = 1 in my recent TYPO3 sites, as I want full control over the page template.
But this not only throws out the html tag etc., but also the default Js (which could be used to uncrypt mailto-Links.
One solution would be to copy this TYPO3-generated JS from the core code and insert it manually. Very simple: just set config.disableAllHeaderCode = 0, load the page once, copy the js, done. But, in case of an update or settings change, this might break.
So: is it possible to access this "default JS" via typoscript and assign it to the PAGE object?
Have a look at https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/Page/PageGenerator.php. You will see that the spam protection code is hardcoded and only added to the page output if config.disableAllHeaderCode is not set.
Therefore I don't see a possibility to do that. Therefore the answer seems to be no, unless you XCLASS the PageGenerator. I would just copy the JavaScript code; I'm using TYPO3 for some years now and wouldn't remember that the spam protection code ever changed.
There is a solution I think. Go to /typo3/sysext/cms/tslib/templates. There is a file tslib_page_frontend.html. This file is responsible for rendering the whole page including the head. You can define a new path to the above mentioned file. For example set the following code:
config.pageRendererTemplateFile = PATH_TO_YOUR_THEME//Resources/Private/Core/tslib_page_frontend.html
respectively
page.config.pageRendererTemplateFile = PATH_TO_YOUR_THEME//Resources/Private/Core/tslib_page_frontend.html
The new template file can look like the following small snippet:
###JS_INLINE###
###BODY###
That way the inline JS is still rendered (and I think the spam protections JS is inline JS - which can be stored in external files).

TYPO3 - how to set the <base> tag in the header of generated html pages?

I have inherited ownership of a website running on TYPO3 version 4.2.1. There are two pages that are not rendering correctly, and this seems to be down to a failure to load css and javascript files. Inspecting the page source, I can see that the <base href="blah..." /> tag is missing from the page header.
The question: how on Earth do I set the base url property in TYPO3!?
I have poured over the Typo3 website, edited various "typoscript" files, offered sacrafices to the PHP gods, all to no avail. The generated code still does not include the tag.
Any help appreciated. Please note it is not possible for me to "upgrade to the latest version", and my PHP knowledge is non-existant.
Adding this line to the "Setup" field of your site's main TypoScript template ought to do it:
config.baseURL = < URL here >
The "TSRef" (TypoScript Reference) is a key document for every TYPO3 site administrator -- it's available online here:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/current/
I recommend printing out a copy to keep at your desk, you will be referring to it frequently. (They provide it in OpenOffice format as well, to make this easy.)
Section 1.6 ("Setup") describes all the properties you can set via TypoScript's CONFIG object:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.0/view/1/6/#id2512147
P.S. While I wasn't going to recommend you download the latest version to fix this problem, I will recommend you download the latest version to be sure you haven't missed any security patches.
Here is how to set the baseurl within the v4.5 introduction package:
Template > Home > Edit Whole Template Record
Includes (between Options and Recources tab )
Click on the little template icon to the left of ROOT, choose Edit
Under Constants > Config, enter the base domain as shown below (leave out the <>
Rememember to clear all cache and then to Ctrl + F5 to complete refresh the browser
TS:
config {
# cat=config; type=boolean; label=Admin Panel: Turn on admin panel (mainly for testing purposes only)
adminPanel = 0
# cat=config; type=boolean; label=Debugging: Turn on debugging (testing purposes only)
debug = 0
# cat=config; type=string; label=Domain name for Base URL: (excluding slashes and protocol like http://)
domain = < ENTER YOUR DOMAIN HERE >
}