• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] CI4 - Unable to Autoload Markdown Class

#1
I am in the process of trying to use CI4 for an existing PHP program that utilises MarkDown.

In accordance with the CI4 Manual I have added the following to /app/Config/Autoload.php
PHP Code:
        /* Files available:
            Markdown.inc.php
            Markdown.php
            MarkdownExtra.inc.php
            MarkdownExtra.php
            MarkdownInerface.inc.php
            MarkdownInerface.php
        */
        
$fff '/var/www/ci2/php-markdown/Michelf/MarkdownExtra.inc.php';    
        
$classmap = [
         
        'Markdown' => $fff
        
];        
        
// $classmap = []; // ORIGINAL SCRIPT 

Unfortunately I am unable to use CI4 way of using Markdown

I can only get it to work using require_once('Class_MarkDown.php); ...

...as can be seen in the following class:
PHP Code:
<?php 
declare(strict_types=1);

namespace 
App\Controllers;

use 
CodeIgniter\Controller;
# use App\Models\UserModel;

require_once '/var/www/ci2/php-markdown/Michelf/MarkdownExtra.inc.php';
use 
Michelf\MarkdownMichelf\SmartyPants;
// use Markdown, Michelf\SmartyPants;
// use Markdown, SmartyPants;
// use Markdown;

# ==========================================================
class Home extends BaseController
{

# ==========================================================
public function index()
{
 
 // $fff = file_get_contents(WRITEPATH .'markdown/BLURB-head.md');
 
 $fff  '## Markdown test to see if H2 works OK';

 
 $txt Markdown::defaultTransform($fff);
 
   
  $body 
'<div class="tal bd4 p42">'
 
         $txt
        
'</div>'
 
       ;

 
 $data['header'] = $this->header();
 
 $data['body'  $body;
 
 $data['footer'] = $this->footer();

    return 
view('v_home'$data);
}
//


}///
# ========================================================== 
download and make your system directory strict
Reply


Messages In This Thread
[SOLVED] CI4 - Unable to Autoload Markdown Class - by John_Betong - 04-26-2019, 12:39 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.