i'm a beginner with zend framework2,
i followed two tutorial on how to build module, followed instruction step by step, but when finished i have a blank page on my browser!!
one of my tutorials is:Zend Framework 2.0 by Example(creating user module)
what should that according to??
'Module (Users) could not be initialized.'
As you mentioned in your comment it could be the problem of missing module(Users) name in application.config.php which is located under config folder.
return array (
'modules' => array(
'Application', 'Users' //<== mentioned your module name here
),
....
);
--SJ
Related
I know there are multiple Threads with a similar Question but I hope that someone can give me an individual solution.
So I am working on an Existing Typo3 7.6.23 Project with already multiple plugins running, I tried to copy every instance that I could find to replicate a plugin and customize it for my use. That didn't work. I couldn't see the Plugin in the Dropdown List.
Then I tried to follow the steps from this link.
(1) registerPlugin
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'DocumentService',
'DokumentenService'
);
(2) configurePlugin
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'TYPO3.' . $_EXTKEY, 'DocumentService', array(
'Example' => 'showDocumentService',
),
// non-cacheable actions
array(
'Example' => '',
)
);
I should be able to select the Plugin in the Backend Dropdown List. But it just does not appear in my Plugins List in the Content Element where I need it.
I even created a Template in the Right Folder and created an Action for it in the Controller..
I'm stuck here and would love to hear a solution as soon as possible.
You are writing about about a service.... Ist the extension just a typo3 Service, you won't be able to select it as extension in the backend...
Have a look at "ext_localconf..."
Is there a \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService(...
Then the extension could be just a service.
Here is a working sample from Aimeos Webshop. Please note you have to change the name of the plugin, you should not use TYPO3. or Aimeos. for the plugin name instead choose your own name.
configurePlugin example from https://github.com/aimeos/aimeos-typo3/blob/2018.04/ext_localconf.php#L27, this configures your plugin for the frontend:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Aimeos.' . $_EXTKEY,
'locale-select',
array( 'Locale' => 'select' ),
array( 'Locale' => 'select' )
);
registerPlugin example https://github.com/aimeos/aimeos-typo3/blob/2018.04/ext_tables.php#L60, this shows your plugin in the backend:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Aimeos.' . $_EXTKEY,
'locale-select',
'Aimeos Shop - Locale selector'
);
And here is the entry point of the action https://github.com/aimeos/aimeos-typo3/blob/2018.04/Classes/Controller/LocaleController.php#L27
The Extension Builder can help you to setup a new TYPO3 extension and is available for TYPO3 v7.6 too see https://extensions.typo3.org/extension/extension_builder/.
And finally here is the documentation on writing extensions for TYPO3 v7.6 https://docs.typo3.org/m/typo3/reference-coreapi/7.6/en-us/ExtensionArchitecture/Index.html.
Good day.
I've just started learning ZF2, replicated the Album example step-by-step, and then decided to make it a bit more interesting by adding user registration, and then make the two work together in some way, so i added a new 'Auth' module.
So, when i only had one module in the module list (aside from the Application module) in application.config.php, it was all fine, but when i added the Auth module to the list like so:
'modules' => array('Application', 'Album','Auth',)
i got the following error when trying to access any views from the album module which was working absolutely fine prior to this change:
Zend\View\Renderer\PhpRenderer::render: Unable to render template "album/album/index"; resolver could not resolve to a file
But when i changed the order in which the modules are presented in this array like so:
'modules' => array('Application', 'Auth','Album',)
not a single view (and it has only one) from the Auth module could be rendered, while the Album module was fine.
Zend\View\Renderer\PhpRenderer::render: Unable to render template "auth/user/index"; resolver could not resolve to a file
Both of these views exist at these locations, but the renderer doesn't see them for some reason.
You can see the project's contents here.
Thank you for any tips in advance.
Looks like you copy pasted the the view manager config for Auth module.config.php.
This should be auth rather than album for your templates to work correctly.
'view_manager' => array(
'template_path_stack' => array(
'auth' => __DIR__ . '/../view',
),
),
I'm trying to list my newly created module(account_test) that copied from "account" module in OpenCart 2.x (account module shows in backend system->design->layouts-> edit home layout). I have duplicated all account php & tpl files to account_test & tpl files and change all references from account to account_test in both admin & catalog module/language/view folders.
Also, I noticed in admin\controller\design\layout.php the if statement which add only Account & Category modules to Layouts setting:
if ($this->config->has($code . '_status') || $module_data) {
$data['extensions'][] = array(
'name' => $this->language->get('heading_title'),
'code' => $code,
'module' => $module_data
);
}
If i remove the if condition :
$data['extensions'][] = array(
'name' => $this->language->get('heading_title'),
'code' => $code,
'module' => $module_data
);
It will add all modules to layouts view, but none of them working except old modules
Stuck in this for few days, Any ideas to list newly created module to layouts admin section and front end?
Is you module get installed or not? If you followed correctly then it must be listed in admin->extension->modules. And then from there you have to first install it and then enable it. And also make sure the controller file named properly.
Edit
$this->config->has($code . '_status') checks whether you module is installed or not i.e. is it in setting table or not. Check in setting table for your module code.
I want to make my own module in zend framework2, I have tried this below code as per the doc. mentioned
return array(
'modules' => array(
'Application',
'Album',
'Photo',
'SanAuth',
'Newmodule', // <- here is my newly added module name
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
);
But when I add this only one line code! my all working module gives blank result even which are working fine started giving blank result!
How can I come out from this ?
What you did is enabling the Module. You should have created it first.
Take a look here.
And you can use ZFTool for module managing (it saves you from the dull process).
It's normal to see a blank screen. There is an Exception being thrown which is probably saying that your module doesn't exist or something like that. Make sure you set display_errors = On in your php.ini, so you can debug in an easier manner.
All you have done it tell Zend to start looking for a new module, but you have yet to create the module.
to create the module you need to add a folder with the same name under the ./module folder.
namespace ModuleName;
Class Module {
}
which is the minimum a module needs to load.
iam using zend framework to build a REST web service and i am using modules to separate my api versions, as i have mentioned here
Ex: "applications/modules/v1/controllers", "applications/modules/v2/controllers" have different set of actions and functionality. I have mentioned my default module as "v1" in my application.ini
I am using context switching along with Regex Routing as i have mentioned here in my accepted solution:
$router->addRoute(
'route1',
new Zend_Controller_Router_Route_Regex(
'api/([^-]*)/([^-]*)\.([^-]*)',
array(
'controller' => 'index',
'action' => 'index'),
array(
1 => 'module',
2 => 'controller',
3 => 'format'
)
));
This is my url: http://localhost/api/v1/tags.xml
"v1" indicates module. Now, coming to context switching, if the url has v1, it is going to v1 module's TagsController. But if the module in url is v2, i am getting an error such as:
The requested URL
/pt/public/index.php/api/v2/tags.xml
was not found on this server.
I could not understand why its blowing up. Is it because i have put the default module as v1? I am not able to change the module based on the url.
And this is my directory tree:
application
modules
v1
controllers
TagsController.php
v2
controllers
TagsController.php
library
My goodness... i have figured out the solution... the controller class name in the v2 module must be "V2_TagsController", not just "TagsController". Thank God, it is working now :)
See the class names for controllers below:
- application
- modules
- v1
- controllers
- TagsController.php (class TagsController)
- v2
- controllers
- TagsController.php (class V2_TagsController)
- library