TYPO3 Form Multicheckbox Partial - forms

I tried to edit the core file form\Resources\Private\Frontend\Partials\Field\Field.html to change the html output in the frontend. If I change that file, it has not effetcs. If I change the core file form\Resources\Private\Frontend\Partials\Textarea.html it effects the output in the frontend.
I've tried to set a custom partial, layout and templates folder like this:
I've set the following in the setup part of the page template:
plugin.tx_form {
settings {
yamlConfigurations {
# register your own additional configuration
# choose a number higher than 30 (below is reserved)
100 = fileadmin/my_site_package/Configuration/Form/CustomFormSetup.yaml
}
}
}
In fileadmin/my_site_package/Configuration/Form/CustomFormSetup.yaml I have
TYPO3:
CMS:
Form:
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
templateRootPaths:
20:'fileadmin/my_site_package/Resources/Private/Templates/Form/Frontend/'
partialRootPaths:
20: 'fileadmin/my_site_package/Resources/Private/Partials/Form/Frontend/'
In the folder fileadmin/my_site_package/Resources/Private/Partials/Form/Frontend/ I have the copied Multicheckbox.html and the other copied partial files from the form core folder. I have edited the Multicheckbox.html, but it has not effects to the frontend.

Thank you so much for your input. The problem was because of the bootstrap package. There was a file Multicheckbox.html in the folder "typo3conf/ext/bootstrap_package/Resources/Private/Partials/Form". This one overrided the core file Multicheckbox.html
But what am I doing wrong in my steps? I'm getting now the following error in the frontend:
Oops, an error occurred!
Tried resolving a template file for controller action "FormFrontend->form" in format ".html", but none of the paths contained the expected template file (FormFrontend/Form.html). No paths configured.
More information regarding this error might be available online.
Did I set the paths in CustomFormSetup.yaml wrong?
I've also tried
TYPO3:
CMS:
Form:
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
templateRootPaths:
1:'/my_site_package/Resources/Private/Templates/Form/Frontend/'
partialRootPaths:
1:'/my_site_package/Resources/Private/Partials/Form/Frontend/'
with the same error.

Related

Magento 2 Block Template Path

I'm getting this error trying to create a .phtml template.
1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'CleverSoft_Base::images_dimensions_chart.phtml' in module: '' block's name: 'magento\framework\view\element\template_0'
I don't understand the two :: after CleverSoft_Base what does those two dots stand for and what should be the path in my child theme for the overwrite?
If you're overwriting a template your have to set your own module
Vendor_Module::images_dimensions_chart.phtml
the base-path for frontend templates in your module is always Vendor/Module/view/frontend/templates

TYPO3 EXT:webkitpdf does not render PDF file

Using EXT:webkitpdf with TYPO3 7.6 worked very well. But "suddenly" the PDFs were corrupted or no PDF file was written (just empty temp-files). There is also no entry in the EXT:webkitpdf-Log.
After some investitgation I found this in my TYPO3-error-Log:
10-02-17 12:49 - core: Core: Error handler (FE): PHP Warning: Cannot modify header information - headers already sent in /is/htdocs/wpXXXXXXXXX/www/typo3_sources/typo3_src-7.6.13/typo3/sysext/frontend/Classes/Utility/CompressionUtility.php line 54
Okay, it's the FE:compression!
After turning off [FE][compressionLevel]=0 in InstallTool, all works fine again!

How to run custom php script from doc root in magento2

I wanted to add custom php script to magento2 root folder and run from the browser.I tried to add it in magento2 root folder but it redirects to 404 page.
I also tried to add it in pub folder but no success.
Also cleared cache and empty generation folder.
I am using nginx server
If you are using nginx configuration that comes with magento you need to put a file inside pub folder to allow access to it from the browser as pub is the document root of the vhost. Magento root dir is one level up. Second of all default config for nginx allows only to access index.php, get.php, static.php, report.php, 404.php and 503.php files. Any other are not processed by the php. You can see this in line with location ~ (index|get|static|report|404|503)\.php$ { in nginx.conf.sample. If you are not using it check your config for similar rule. To allow another file to be accessible from browser simple add another name after 503 or change entire brackets with location ~* \.php$ {
Source: https://magento.stackexchange.com/a/97290/1883
For example you can get product name in custom script by this step
step 1: create index.php at root of magento 2
magento2/test/index.php
<?php
require __DIR__ . '../../app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication('customScript');
$bootstrap->run($app);
step 2: create customScript.php
magento2/test/customScript.php
<?php
class customScript
extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$this->_state->setAreaCode('frontend'); //Set area code 'frontend' or 'adminhtml
$id = 12;
$_product = $this->_objectManager->create('\Magento\Catalog\Model\Product')->load($id);
echo $_product->getName();
return $this->_response;
}
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
{
return false;
}
}
Now you can run this custom script by
http://10.16.16.196/magento2/test/
As stated by #Ranjit, the /pub folder must be your Magento root folder.
The correct way to run a standalone php script on Magento would be:
On nginx:
Locate location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ { and add your file there.
I.e:
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|myphp)\.php$ {
Then you can access yourstore.com/myphp.php.
On Apache:
Simply add the file under /pub folder. I.e.: /pub/myphp.php.
Apache rewrites rule will redirect to index.php if the file or folder doesn't exist.
In my case on Apache (cPanel) the problem was that file permissions of .php files should not be writable by group or others to be served directly, else Magento's 404 would open.
So in my case to serve file directly I had to set file permission to -rw-r--r-- (on Linux).
This is the mostly issue with servers using suPHP.
Putting this here in case someone runs into same situation...

How to change the config file for MathJax in doxygen?

I am using doxygen 1.8.9.1 and want to use AsciiMath in the hmtl output. It requires me to use a new config file, i.e. http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML. However, the configuration "MATHJAX_RELPATH" can only set the root path of mathjax.
How could I change the config to mathjax? Thanks for any suggestions.
EDIT:
I have tried to use MATHJAX_CODEFILE to change the config file "config: ["local/local.js","MMLtoHTML.js"]", but don't work for me. The URL should be modified, not just the configuration files. (i.e. MathJax.js?config=AM_HTMLorMML).
BTW: The render html should be change from \[sum_(i=1)^n i^3=((n*(n+1))/2)^2\] to `sum_(i=1)^n i^3=((n*(n+1))/2)^2`.
One solution is to modify MATHJAX section of footer.html in the Doxygen folder.
For example, use this to modify the url to MathJax.js?config=local/local.js
<!-- BEGIN MATHJAX-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="../mathjax/MathJax.js?config=local/local.js"></script>
<!-- END MATHJAX-->
The $mathjax line of header.html should also be deleted.

ReferenceError: JST is not defined in Sails.js

I have an ejs javascript template in:
/assets/linker/template
I changed the line in gruntfile.js from:
linker/**/*.html to linker/**/*.ejs
I have underscore.js in:
assets/linker/js
But when I try:
JST['assets/linker/templates/addUser.ejs']( obj ) from app.js
I get this error in the console:
ReferenceError: JST is not defined
Any help would be appreciated! Thanks!
I had the same problem. I solved it by manually linking JST into my index.ejs file.
so I just added
<script type="text/javascript" src="/jst.js"></script>
where I load my javascripts in sailsProject>views>home>index.ejs.
Not pretty, as the linker should do the job, but for now it works.
cheers
The Pipeline
The template files that are injected are specified in tasks/pipeline.js
The default is set to:
var templateFilesToInject = ['templates/**/*.html']
Files in assets/templates (or any subdirectory) with the .html file extension are injected.
Also check out the JST task in tasks/config/jst.js. It takes the template files to inject (from pipeline.js) and precompiles them into a file called jst.js.
Only once these other tasks have completed does the sails-linker begin its task. tasks/config/sails-linker.js takes the jst.js that was generated by the JST task and includes it into the template start and template end tag in .tmp/public/index.html, views/**/*.html, and views/**/*.ejs.
So the default pipeline for client-side templates is:
Precompile templates/**/*.html into jst.js
Include jst.js in index.html, views/**/*.html, and views/**/*.ejs between <!--TEMPLATES--> and <!--TEMPLATES END-->
Customization Examples
All of this default configuration can be changed to suit your needs. For example, to have templates with a different extension or multiple extensions edit the templateFilesToInject in tasks/pipeline.js:
let templateFilesToInject = [
'vendor/templates/vendor_template.html',
'templates/**/*.ejs',
'templates/**/*.html'
]
Or to only inject templates on specific views if they have the comment <!--TPL--><!--END TPL-->, edit the devTpl config in tasks/config/sails-linker.js:
// Bring in JST template object
devTpl: {
options: {
startTag: '<!--TPL-->',
endTag: '<!--END TPL-->',
fileTmpl: '<script type="text/javascript" src="%s"></script>',
appRoot: '.tmp/public'
},
files: {
'views/that/use/templates/**/*.ejs': [
'.tmp/public/jst.js'
]
}
}