Fatal error installing Twiggy with Codeigniter/HMVC - php

when trying to install twiggy with codeigniter/HMVC I get the following error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$twiggy
Filename: MX/Controller.php
Line Number: 58
I have installed twiggy as described on http://edmundask.github.io/codeigniter-twiggy/
The only thing I did was change the name of the spark MY_Loader.php to MY_Spark_Loader.php because it had the same name as the HMVC MY_Loader.php
I have autoloaded twiggy in the autoload.php like this:
$autoload['sparks'] = array('twiggy/0.8.5');
My controller looks like this:
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Test extends MX_Controller
{
public function index()
{
$this->twiggy->display();
}
}
Any help to get this running would be much appreciated!

Make sure that the autoloader is pointing to the correct location. Mine looks like this: $autoload['sparks'] = array('../tools/sparks/Twiggy/0.8.5');

Did you follow this instruction
http://getsparks.org/set-up-mx
It explains how to install spark manager with hmvc, but there is a bug, if you run $this->router->fetch_modules() in modules which is run from another module it doesn't return current running module, it returns original module.
To fix that, don't replace MX/Loader.php with the one provided there, just use hmvc original file, but add two functions to load sparks from that loader to hmvc loader file.
For MX/Modules.php do the same thing, just take spark specific code to hmvc original file.
Sorry for my bad english. Hope you understand

Related

Class 'Magento\Framework\App\Action\Action' not found

I'm running Magento v2.2.2 on MAMP (PHP 7.0.33), and am trying to debug a third party module that deals with tracking numbers.
The full error that shows in my MAMP/logs/php_error.log when I try to run the module is as follows:
PHP Fatal error: Class 'Magento\Framework\App\Action\Action' not found in /Applications/MAMP/htdocs/magento/app/code/Orderinfo/Details/Controller/Index/index.php on line 20
PHP Stack trace:
PHP 1. {main}() /Applications/MAMP/htdocs/magento/app/code/Orderinfo/Details/Controller/Index/index.php:0
Here is what Applications/MAMP/htdocs/magento/app/code/Orderinfo/Details/Controller/Index/index.php looks like:
namespace Orderinfo\Details\Controller\Index;
use Magento\Framework\Controller\ResultFactory;
class Index extends \Magento\Framework\App\Action\Action {
protected $_productloader;
protected $_messageManager;
protected $_pageFactory;
public function __construct...(and so forth)
The weird thing is, the command setup:di:compile runs just fine (it also fails to compile as expected when I modify the above line to say something like class Index extends \Bogus\Magento\Framework\App\Action\Action.)
I've confirmed that the Framework/App/Action/Action.php file/class exists in magento/lib/internal/Magento, magento/vendor/magento, and magento/app/code/Magento. I also modified the .htacess of those directories to grant all access.
I'm pretty lost, if anyone has ever encountered this problem before and could give me some other things to try, that'd be awesome.
Thank you!

Codeigniter - Problem while including env file

I'm trying to include .env file in Codeigniter 3 by following steps:
integrating.env files in CodeIgniter 3.0 using hooks
But, it returns the following error
A PHP Error was encountered Severity: 4096
Message: Argument 1 passed to Dotenv\Dotenv::__construct() must be an
instance of Dotenv\Loader, string given, called in
/application/config/hooks.php on line 5 and defined
Filename: src/Dotenv.php
Line Number: 31
My /application/config/hooks.php file is configured in the same way as indicated in the tutorial:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$hook['pre_system'] = function() {
$dotenv = new Dotenv\Dotenv(APPPATH);
$dotenv->load();
};
I had done a quick research and unable to find a perfect solution for the problem occurred, Can you guys please help me to find out a solution?
I was able to install phpdotenv in a different way from the instructions in the first tutorial.
In this tutorial installation is done without the use of Composer:
PHPDotenv for CodeIgniter (Installation without Composer)
If you try something like that :
$dotenv = Dotenv\Dotenv::create(__DIR__);
I assume the vendor folder is in project/vendor, not inside project/application/vendor folder. Then try this:
$hook['pre_system'] = function() {
$dotenv = Dotenv\Dotenv::create(FCPATH);
$dotenv->load();
};

How to use regular models/libraries along with package in codeigniter?

I'm having trouble using packages in codeigniter.
My folder layout is:
/applications
/regular_application1
/regular_application2
/common_pkg
In common_pkg, I have models that I want both applications to be able to use. In order to load the package, I added the route to it in $autoload['packages']-
$autoload['packages'] = array(FCPATH.'applications/common_pkg/');
This works fine, in both applications in any controller I can now load the models using:
$this->load->model("Balance_model");
The problem is that after this, I want to load a library from within my regular_applicationx. So I call from within my controller (the controller is in regular_applicationx:
$this->load->library("Selections_library");
But when I try to use the library, I get:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Selections::$Selections_library
I'm surmising from the above that once I set my package to common_pkg in the autoload, CodeIgniter is only looking there for libraries and models. Is there any way to load both from the regular application and common_pkg?
Thanks!

PHP Framework Zend not Working

When I try to load it some error occurs that prevents the rest of the page from loading.
My file basically looks like this:
use Zend\Form\Form;
include 'Zend/Form/Form.php';
$form = new Form();
// Page Content
What am I doing wrong?
PHP Errors:
Fatal error: Class 'Zend\Form\Fieldset' not found in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/contest-guess-image/Zend/Form/Form.php on line 24
You can't use ZF2 without autoloading. Composer makes this easy, if you're not using composer you'll need to setup the ZF2 standard autoloader yourself before using any other ZF2 classes.

Fatal error: Undefined class constant 'EXCEPTION_NO_ROUTE' in Zend framework

I have downloaded Zend latest version(Zend Framework 1.11), then created the project using command line tool.
Also I've created controller in the created project. In the created controller Just I've added new method,
<?php
class UserController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
public function chatAction()
{
echo 'Test';
}
}
then tried to access in the browser
http://localhost/user/chat
I got the following error
Fatal error: Undefined class constant 'EXCEPTION_NO_ROUTE' in F:\xampp\htdocs\z_app\application\controllers\ErrorController.php on line 16
Thanks in advance.
You probably have the wrong zend library included.
Check your version via echo Zend_Version::VERSION; in index.php and die() before bootstrapping (as your mvc is broken).
You may need to update your include path to the correct location of the 1.11 zend framework library. Probably you have multiple versions (i.e. zend studio comes with its own) installed.
Thank you friends, Finally I resolved the issue by just copying the Zend directory inside of the library of Zend framework directory to my project directory. Now it is working.
F:\xampp\htdocs\zend\library
To
F:\xampp\htdocs\z_app\library
Even though I've added the include path in the php.ini to the zend framework library directory like below,
include_path = ".;F:\xampp\php\PEAR;F:\xampp\htdocs\zend\library
It wasn't working.

Categories