TYPO3 v7.6.0 (create custom extentions) - plugins

To create an extension using the Extension Builder. Then I add to the page. The result is an error. The logs the following text:
Call to a member function findAll () on a non-object in .... DbtestController.php on line 43.
I would like to know what is the reason? and how to fix it.
Is there a manual, to build extentions in typo3 v7.6.0?
The fact that up to this point I have worked with typo3 v4.6.

There is an "ExtensionBuilder 7.6.0" manual at https://docs.typo3.org/typo3cms/extensions/extension_builder/ .

Related

Where must finisher files (for powermail finisher) be located?

I am currently trying to add a finisher to my powerplay form.
The target is to delete all elements in a specific folder after the form is submited.
I currently use :
this tutorial
I first put this into my setup.txt
plugin.tx_powermail.settings.setup {
finishers {
1 {
class = Vendor\Ext\Finisher\DoSomethingFinisher
}
}
}
at this location: ftp://ftpIP/typo3cms/pagename/typo3conf/ext/powermail/Configuration/TypoScript/Main/setup.txt
Now i should create a PHP-File:
Add a php-file DoSomethingFinisher.php and extend your class with the AbstractFinisher from powermail:
But where shuld I place that PHP File? In the same place as the setup.txt?
Hope someone can help. Thank you very much.
Thomas
That question is related to TYPO3 autoloading and not to powermail. If you want to add PHP-Files to your TYPO3, you should use an extension.
There are some manuals how to get the autoloading to work with your PHP-Files (see https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Autoloading/Index.html).
You shouldn't modify the files in the folder powermail, otherwise you will be in trouble when you want to update the extension. Instead, create a new extension with extension_builder or take powermailextended and modify that extension.
Assuming you use powermailextended:
If you call the Finisher In2code\Powermailextended\Finisher\MyFinisher, then it needs to go in EXT:powermailextend\Classes\Finisher\MyFinisher - this is how Typo3 autoloads the PHP files.

Passing argument from one plugin to another

I have one extension that has 2 plugins. I would to pass an argument from plugin1 to plugin2.
In plugin1's view I generate a link to a page where a content element for plugin2 is inserted:
<f:link.action controller="ApplicationController" action="showFormAction" arguments="{test: 1}" pageUid="40">Link</f:link.action>
In ApplicationController I try to retrieve the test parameter like this:
$this->request->getArgument('test');
But I get this error:
#1176558158: An argument "test" does not exist for this request.
Is there a way to solve or debug this ?
You simply forgot to set pluginName="Plugin2Name" in your f:link.action viewhelper call. You can see that the link currently contains the desired argument but with the namespace of the 1st plugin. If you add pluginName, the namespace will be changed to the 2nd plugin.

Typo3 Extension PHP View

Using the infos in this link:
https://docs.typo3.org/typo3cms/ExtbaseFluidBook/8-Fluid/9-using-php-based-views.html
I try to create an action to output a JSON.
I have a normal controller with the list action:
public function listAction()
{
$storelocators = $this->storelocatorRepository->findAll();
$this->view->assign('storelocators', $storelocators);
}
And in ext/my_storelocator/Classes/View/Storelocator I have a class List.php:
<?
class Tx_MyStorelocator_View_Storelocator_List extends Tx_Extbase_MVC_View_AbstractView {
public function render() {
return 'Hello World';
}
}
All I get is:
Sorry, the requested view was not found.
The technical reason is: No template was found. View could not be resolved for action "list" in class "My\MyStorelocator\Controller\StorelocatorController".
So I guess there is something wrong with the paths. Or where is the Problem?
Edit: Extensioninfos
Vendor: My
key: my_storelocator
controller: NOT SURE (I created it with the extension_builder so I guess my controllers name is Storelocator)
action: list
From my understanding a classname like Tx_MyStorelocator_View_Storelocator_List should be correct. But its not working
You will need to create an empty file for the HTML view for your controller, e.g. Resources/Private/Template/Storelocator/List.html, even if you do not plan to use the HTML view or if you just return the content yourself (which is perfectly fine).
The reason for this is simply technical limitation.
First of all, TYPO3 now has a built-in JSON view, described thoroughly here: https://usetypo3.com/json-view.html. It lets you easily define which properties you'd like to render.
The error message means that your Controller is still pointing to the TemplateView - because thats the error the TemplateView throws if it can't find the defined template file.
You can specify which view to use to render within your controller. You can either set a default view via the $defaultViewObjectName property, like so:
/**
* #var string
*/
protected $defaultViewObjectName = '\TYPO3\CMS\Fluid\View\TemplateView';
You can also set it from within the Controller inside initialization actions like so:
public function initializeExportPDFAction(){
$this->defaultViewObjectName = 'Vendor\Extension\View\FileTransferView';
}
(I have, however, not yet found a way to define the template from within actions, any tips in the comments would be appreciated)
Your path syntax is probably out of date. Instead of writing a render() function in Classes/View/Storelocator/List.php, try writing a listAction() function in a Classes/Controller/StorelocatorController.php file. Extension Builder should have created this file for you, if you made an aggregate model with the usual "list, create, edit ..." and such actions.
Review A journey through the Blog Example and the following chapter, Creating a first extension, for tips.
Keep in mind that there is a mismatch between the documentation and the Extension Builder generated PHP code files. Developing TYPO3 Extensions with Extbase and Fluid has some parts up to date, and other parts still using old syntax.

How do I use dce:explode() in typo3?

sorry, but I don't know which other Tags to use for this question.
I'm using typo3 with dce extension. I want to use dce:explode to separate values from a comma separated string:
{field.category -> dce:explode(delimiter:',')}
field.category contains "value1,value2,value3"
But this gives always an error in the frontend:
Oops, an error occurred! Code: 2015082814003052e1ee30
Can anyone help?
I solved it. I'm just a typo3 noob and simply forgot to define the dce namespace before using it:
{namespace dce=ArminVieweg\Dce\ViewHelpers}
Now it works fine

Template could not be loaded in TYPO3 extension

Am using a new extension build in TYPO3 V4.5.0 and after it installed it in TYPO3 V6.2.x it shows the following error
The template files "/var/www/dev/typo3/typo3conf/ext/my_ext/Resources/Private/Layouts/Suche.html", "/var/www/dev/typo3/typo3conf/ext/my_ext/Resources/Private/Layouts/Suche" could not be loaded.
The layout i s present in the location. and path given also correct in backend..
How can i fix this?
Check so template filename has first letter uppercase.
The rule is that for action named fooBarAction() template file must be named FooBar.html