SalFay / Codeigniter-Blade-Theme-Engine

CMS Like Theme engine for Codeigniter with Laravel's Blade
MIT License
21 stars 6 forks source link

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

Open AyhanALTINOK opened 5 years ago

AyhanALTINOK commented 5 years ago

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
FayazK commented 5 years ago

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

Thanks

AyhanALTINOK commented 5 years ago

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

FayazK commented 5 years ago

hi @AyhanALTINOK

Can you please uninstall and reinstall the composer blade package

use version 4.0.* or earlier

Thanks

AyhanALTINOK commented 5 years ago

Thank you for your help.