Codeigniter-Blade-Theme-Engine icon indicating copy to clipboard operation
Codeigniter-Blade-Theme-Engine copied to clipboard

Return value of duncan3dc\Laravel\Directives::register() must be an instance of duncan3dc\Laravel\void, none returned

Open AyhanALTINOK opened this issue 7 years ago • 4 comments

CodeIgniter 3.1.9 version help me

An uncaught Exception was encountered
Type: TypeError

Message: Return value of duncan3dc\Laravel\Directives::register() must be an instance of duncan3dc\Laravel\void, none returned

Filename: /home/mark5062/crm/vendor/duncan3dc/blade/src/Directives.php

Line Number: 172

Backtrace:

File: /home/mark5062/crm/vendor/duncan3dc/blade/src/BladeInstance.php
Line: 104
Function: register

File: /home/mark5062/crm/vendor/illuminate/view/Engines/EngineResolver.php
Line: 54
Function: call_user_func

File: /home/mark5062/crm/vendor/illuminate/view/Factory.php
Line: 286
Function: resolve

File: /home/mark5062/crm/vendor/illuminate/view/Factory.php
Line: 250
Function: getEngineFromPath

File: /home/mark5062/crm/vendor/illuminate/view/Factory.php
Line: 136
Function: viewInstance

File: /home/mark5062/crm/vendor/duncan3dc/blade/src/BladeInstance.php
Line: 332
Function: make

File: /home/mark5062/crm/vendor/duncan3dc/blade/src/BladeInstance.php
Line: 346
Function: make

File: /home/mark5062/crm/application/libraries/Theme.php
Line: 50
Function: render

File: /home/mark5062/crm/application/controllers/Welcome.php
Line: 12
Function: display

File: /home/mark5062/crm/index.php
Line: 315
Function: require_once

AyhanALTINOK avatar Aug 19 '18 14:08 AyhanALTINOK

Hi @AyhanALTINOK Please let me know the procedure of how you implemented it and the code.

Thanks

FayazK avatar Aug 19 '18 14:08 FayazK

Hi @FayazK I have added the following code to the "config/autoload.php" file

$autoload['libraries'] = array('theme');
$autoload['helper'] = array('theme','url');
$autoload['config'] = array('theme');

I have installed "duncan3dc/blade" composer

I have added the following code to the "config/theme.php" file

$config['blade_engine'] = FCPATH.'vendor/autoload.php';
$config['theme_directory'] = FCPATH.'application/views/'.DIRECTORY_SEPARATOR;
$config['theme_default'] = '';

I updated my welcome.php controller file

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
	public function index()
	{
	    $view_data = array(
	        	'page_title'        => 'Homepage',
			 'description'    => 'description content',
                          'title'                => 'Trial', 
                          'content'          => 'Hello world.'
        );
		$this->theme->display('welcome',$view_data);
	}
}
?>

I updated my welcome.blade.php view file

<DOCTYPE html>
  <html lang="en">
    <head>
      <title>{{$page_title}} - CodeIgniter</title>	
      <meta name="description" content="{{$description}}">
    </head>
    <body>
      <h1>{{$title}} </h1>
      <p>{{$content}}</p>
    </body>
  </html>

thanks

AyhanALTINOK avatar Aug 19 '18 15:08 AyhanALTINOK

hi @AyhanALTINOK

Can you please uninstall and reinstall the composer blade package

use version 4.0.* or earlier

Thanks

FayazK avatar Aug 19 '18 18:08 FayazK

Thank you for your help.

AyhanALTINOK avatar Aug 20 '18 13:08 AyhanALTINOK