I need some help installing the template plugin for CI. Ive dowloaded and copyied the files and folders to the right places but a simple
function index()
{
$this->template->render();
}
in my Welcome (fresh install of CI) results in a error and im thinking im suppose to include the template plugin in the config/autoload somewhere?
Ive tried to follow http://williamsconcepts.com/ci/codeigniter/libraries/template/start.html but it does not describe how to intergate the plugin with the system (unless i missed something)
(the error is "Fatal error: Call to a member function render() on a non-object in")
Add it to $autoload['libraries'] in application/config/autoload.php:
$autoload['libraries'] = array('template');
Related
My Cpanel based server is running on PHP 7.2 using Codieigniter 3.x
public function fxnname()
{
return random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
}
When I run the code, I get the following error:
Call to undefined function random_bytes()
in my custom library code which is placed inside public_html/application/libraries/mycustomlibrary.php
I tried to google and this function should have worked in PHP 7.2. Is there any library/helper which I am missing in autoload or something else is required to be done?
I have Laravel installed and now I keep getting this error everytime I run composer update, php artisan routes, or any composer commands:
Call to undefined method Illuminate\Http\Response::view()
I already searched the internet and tried the following suggested solutions so far and nothing worked:
1) A lot of suggested answer on the net says to delete vendor/compiled.php and run the composer update again. But when I went to vendor folder, I cannot find any compiled.php file there. The only file that exists there is: autoload.php
2) I also tried searching for compiled.php inside storage/framework/ folder and nothing there neither.
3) I even tried running optimize with the --force flag php artisan optimize --force and it shows the same error as above.
4) I looked at boostrap/autoload.php for compiled path and it says $compiledPath = __DIR__.'/cache/compiled.php'; I can only see the boostrap/cache folder and that doesnt have this file.
What is wrong here? I am new to Laravel and I dont understand what this error means. Going by the answers out there, I am going around looking for compiled.php to delete and run the update again and I dont even know if that is the right solution for it. Can someone help me here please on how do I proceed troubleshooting this?
I have Laravel 5.1.6 installed after the update I did yesterday. I also ran the composer dumpautoload command today and I wonder if this error started happening after that. Now any commands in composer is giving the above error.
EDIT:
Now even my browser view of the site is showing the error:
FatalErrorException in Facade.php line 210:
Call to undefined method Illuminate\Foundation\Application::missing()
I also tried deleting the complete vendor folder and composer.lock, and re-ran composer install. Towards the end of the installation when generating autoload files, it showed this error again and stopped.
EDIT 2:
#NehalHasnayeen in the comments got it absolutely right. This error was caused due to app calling the view method on Response class, while the response class had no view method. Once I removed that from my route, it worked. This is my route file:
Route::get('/', function () {
return view('index');
//return View::make('index');
});
Route::group(['prefix' => 'api'], function()
{
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController#authenticate');
});
// -------- THIS WAS CAUSING THE ISSUE - REMOVING THIS WORKED AFTER THAT ------
//App::missing(function($exception) {
// return view('index');
//});
It takes me to my final question, why was the catch-all route throwing this error? I read from here that adding the above will redirect all other route requests to index. What is the right method? Did it change in Laravel 5 or have I done something wrong?
For 1st error:
your app is calling view method on Response class, but response class has no view method, so find the file where it is calling this method & remove it & replace it with correct method
For 2nd error:
App::missing is for laravel 4 version, it is removed in laravel 5. To achieve the same in your app\exceptions\handler.php file add this in render method
public function render($request, Exception $e)
{
if ($e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
return response()->view('index', [], 404);
}
return parent::render($request, $e);
}
I have used ci-merchant before but from everything see that the "V2" of it is now omnipay. I use codeigniter and i'm struggling to get even the example to work.
I have installed omnipay no problems and in my controller have the following:
use Omnipay\Common\GatewayFactory;
class Homepage extends BC_basecontroller {
public function index()
{
$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('adrian');
$gateway->setPassword('12345');
}
}
Which is the example here: https://github.com/adrianmacneil/omnipay
However I get the error:
PHP Fatal error: Class 'Omnipay\Common\GatewayFactory' not found in......
Does anyone know how to get it to work in CI?
I'm not sure how you installed Omnipay, but you need to use Composer to load the classes before you can use them.
So following the Omnipay installation instructions, add this to a composer.json file in your root directory:
{
"require": {
"omnipay/omnipay": "*"
}
}
Then install the files:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Now, if you are using CodeIgniter you will need to set it up to include the composer autoloader. Basically, just add this line to the top of your index.php file:
require_once __DIR__.'/vendor/autoload.php';
There is also a tutorial on using Composer with CodeIgniter here which you may find helpful: http://philsturgeon.co.uk/blog/2012/05/composer-with-codeigniter
I had the same error and fixed it by loading vendor/autoload.php before application/core/CodeIgniter.php
When I click on Shipping Methods tab under Magento system->configuration->SALES tab I am faced with the following error:
Fatal error: Call to a member function toOptionArray() on a non-object in D:\xampp\htdocs\magento\app\code\core\Mage\Adminhtml\Block\System\Config\Form.php on line 463
The most astounding thing is that this is a fresh installation of Magento. Can anyone tell me how can I remove this error?
Add to config.xml
<global>
<models>
<stockindicator>
<class>Namespace_ModuleName_Model</class>
</stockindicator>
</models>
</global>
Following this tutorial solve the problem => http://kb.magenting.com/content/20/49/en/magento-error-call-to-a-member-function-tooptionarray-on-a-non-object.html
Go to Magento Connect Manager, click Check For Upgrades. In Actions, upgrade the modules that have the new version, and reinstall these modules:
Interface_Adminhtml_Default
Mage_All_Latest
Mage_Core_Adminhtml
Mage_Core_Modules
Check mark the "Clear all sessions after successfull install or upgrade", and then click Commit Changes.
This should solve the error:-
Disable Compilation (System -> Tools -> Compilation)
Refresh Cache (System -> Cache Management)
I ran into this issue and none of the existing answers out there helped. After some trial and error, I discovered my issue was due to a case sensitive issue between running on Windows and Linux.
My widget.xml file contained this line:
<source_model>widget/modeoptions</source_model>
My model class was declared as:
class My_Widget_Model_ModeOptions
This worked as expected when deployed out an an Magento instance running in Mirosoft Azure. When I deployed the same exact code to a Magento instance running on Linux, I received the error.
Call to a member function toOptionArray() on a non-object in ../includes/src/Mage_Widget_Block_Adminhtml_Widget_Options.php
After updating the widget.xml to match the class' case, everything worked as expected on a Windows and Linux server.
Updated/fixed line:
<source_model>widget/ModeOptions</source_model>
Hope this might help some others struggling with this error.
According to webshopapps support all you should need to do is compile through system->tools->compilation. Personally I compiled, flushed caches, logged out and logged in again. It worked.
I had previously tried the update modules method and had to restore from a backup after it broke magento 1.9.0.1
Go to app\code\core\Mage\Adminhtml\Block\System\Config\Form.php
find the following on line 463
$optionArray = $sourceModel->toOptionArray($fieldType == ‘multiselect’);
and replace it with:
if(is_object($sourceModel)){
$optionArray = $sourceModel->toOptionArray($fieldType == ‘multiselect’);
} else {
Mage::log($e->source_model);
}
Fatal error: Call to a member function children() on a non-object in includes/src/__default.php on line 20256
this is the error from default.php
$modules = $this->getNode('modules')->children();
under
public function loadModulesConfiguration($fileName, $mergeToObject = null, $mergeModel=null)
I tried to do cache refresh but it went error. I can't go to admin and our server is down.
I'm using Magento 1.4.1.1
Can somebody help me please?
Thanks in advance.
disable compilation from system > tools > compilation or recompile
If you don't disable compile since backend of magento i think you can see the content of include/config.php and you can show two lines into the archive. You can comment it's to disable compilation