Zend 2.2 adding new module, page goes blank - php

I am new to Zend Framework and trying to setup my first module.
Installation goes fine. Everything runs fine i.e. home page and Application module.
Now, Followed all the steps to create Album module but as soon as I add 'Album' module in application.config.php it all goes blank. Home page goes blank as well.
Below is the code I have added.
return array(
'modules' => array(
'Application',
'ZendDeveloperTools',
'BjyProfiler',
'User',
'Album',
),
Can anyone let me know, what I am doing wrong?
Thanks.

When you add the Album module name to the config, the system will attempt to load that module, if any problem exists with that module's base class, it will cause the system to fail with an error. If you have errors turned off then you will not see it, but instead will be presented with a white screen.
check you have errors turned on (error_reporting etc)
make sure you have a class called Module in the Album Namespace.
make sure the Album\Module class is in the module\album\Module.php file
make sure that the code in the Album\Module class does not have any errors in the getConfig method or onBootstrap (if you've added either of those)
Unfortunately without further information on how the module is set up, there is little more we can do to help.

Related

Cake PHP 3 plugin's controller not visible

I moved working plugin from /plugins/pluginname directory to /vendor/myname/pluginname
URL on which I call plugin controller is
http://domain.local/pluginname/index
Before moving from first directory to another, plugin was working as expected. I moved plugin to new directory to make it reusable for other cake PHP apps.
Plugin is installed by composer.
Why do I have message
"Error: Controller class Index could not be found.". All controllers
from plugin are not visible on app, throws the same error. Error is
thrown from line 79 from file
\vendor\cakephp\cakephp\src\Routing\Dispatcher.php
In main bootstrap.php file I put this line:
Plugin::load('MyName/PluginName', ['bootstrap' => false, 'routes' => true]);
Why plugin in vendor directory is not working in my case?
If plugin is installed by Composer, do not move it.
Whether it is installed at the plugin or vendor folder is determined by the author of the plugin.
If you need to fully load the Plugin in your bootstrap, simply use
Plugin::load('PluginName', ['bootstrap' => false, 'routes' => true]);
See http://book.cakephp.org/3.0/en/plugins.html#plugin-configuration
It will simply work regardless if Composer places it in vendor or plugins folder.
Most importantly, leave it in the folder that the author intended it to be in.
Lastly, check that your plugin is suitable for CakePHP 3.x
As for the url, you should expect to use /plugin-name/controller/action
See http://book.cakephp.org/3.0/en/plugins.html#plugin-controllers and I quote
If you want to access what we’ve got going thus far, visit /contact-manager/contacts
You can try by setting autoload variable true.Add below code in bootstrap.php, clear cache and then check.
Plugin::load('PluginName', ['autoload' => true]);

ZF2 Google Maps Module - Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for GMaps\Service\GoogleMap

I'm trying to use this module, https://github.com/gowsram/zf2-google-maps- , but I'm running into a problem.
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for GMaps\Service\GoogleMap
I have followed the instruction in the github readme, and have cloned the project into my vendors directory.
From what I understand, the line which calls the ServiceLocator,
$map = $this->getServiceLocator()->get('GMaps\Service\GoogleMap');
isn't pointing to the right place. Unfortunately my knowledge of how the service locator works isn't deep enough to figure out how to fix the problem, despite attempts to remedy this by diving into the docs. It's all a little over my head.
Thanks for any input you may be able to provide!
Have you edited your application.config.php file so that the modules array contains GMaps? From the look of the error, the module isn't running since the service is not registered with the ServiceManager.
That step appeared to be skipped over in the installation instructions but you should add it to your application config so it runs the module's Module.php code.
application.config.php
return array(
'modules' => array(
'Application',
'GMaps',
),
/...
);

Zend Framework 2 - Internal server error in module

I just created a module with a submodule like Backend\Entity1. I checked every path and namespace, they all seem to be ok.
I took out codeblocks one by one but stil I just get via Firebug a
"NetworkError: 500 Internal Server Error"
Any ideas what I can do to find the error?
I just don't know what might be wrong. Honestly, why does the framework explain itself what is happening? Its just fishing in the dark now...
BTW: The error.log doesn't show something either...
Edit:
I'm guessing that this error is raised because my app can't find the phtml files. Maybe I'm wrong but usually when I get this kind of silly error it has something to do with missing files...
My config code looks like this:
'view_manager' => array(
'template_path_stack' => array(
'entity' => __DIR__ . '/../view',
),
),
My namespace is MasterData\Entity and my add/edit/delete/index.phtml lie under view\masterdata\entity.
Any ideas how I can tell the TemplatePathStack how to look in this dir for my files?
If your want your sub module to be accessed create proper route in the parent module to make a way to access your sub module.
I IMHO if you need to create sub modules, create as module and place the modules under modules folder of your application, if you have components or third party modules place it under vendor folder.
This would be easier to manage at later stages an your url will also be much simpler
In my case, I created the new model in another way but I had the same error when I tried to see the result in the explorer. The problem (in my situation) was the access to files from the explorer, It resolves by changing files's permissions in linux's terminal.

Including a php file in Joomla! 1.5 that calls another php file

I would like to include a PHP program into a Joomla! article, this program calls different PHP files that are used to display what I want, I have tried to install different Plugins such as Jumi, directPHP and others, but I keep getting the following error:
Application raised an exception class EDatabaseError with message 'Cannot connect to database server:mysql error: [0: Connection error to server '' with user ''] in CONNECT(, '', '**', )
'
The program runs fine Standalone, however it does not work when I'm running it on Joomla.
The connection parameters are obtained from an include "config.php" but it seems that they won't get the includes from the included PHP file.
Also when I try to include a menu I have made, which works standalone, redirects me to the index.php of Joomla! root dir.
Thanks.
I've done things similar to this, but have had to install a couple of extensions to get them to work.
First, i use the jce WYSIWYG.
then installed place anywhere (which lets you place modules inside articles)
create a new module, type=Custom HTML
code your php there...
I know this isn't exactly what you're describing, but it's the closest i've come in my experience.
If it doesn't work right away, be sure to check for the settings withing the JCE WYSIWYG so it's not breaking your php.
hope this helps!
Try to use 'Flexi Custom Code' extension is a good one
check it: http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules/15251
Its a module extension which you can use with 'module anywhere' to place in the 'content area'(article). For calling different php file you can use the php include or required once code
Please feel free to ask if any doubts are there....implementing this

Mage registry key "controller" already exists

I have configured an ecommerce site using Magento, but it is throwing an error.
Mage registry key "controller" already exists
I am not sure what to do. The URL for site is http://musicademy.sweetersinging.com/store/admin
This usually happens if you try and run Mage::run() twice - or specifically, once more after the index.php bootstrap.
Sounds like a (extremely) badly written 3rd party extension or template. It (sadly) wouldn't be the first time I've seen someone execute this within a .phtml file.
Go through the standard debug process, refresh between each.
Move app/code/local to app/code/local.bak
Move app/code/community to app/code/community.bak
Move app/design/frontend/your_custom_package to app/design/frontend/your_custom_package.bak
Once you've found the cause above, then you can start to filter through the filters/dirs to check.
If you have Magefirewall extension installed try disabling at the webserver(by going to magento_root_dir/app/etc/modules/magefirewall.xml) and clear the cache (by deleting all the files/folders in magento_root_dir/var/cache/) if you don't have access to the admin panel. Doing this solved the issue for me on Magento CE 1.9.2.2.

Categories