04-26-2019, 12:39 AM
(This post was last modified: 04-27-2019, 11:58 PM by John_Betong.)
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
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:
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\Markdown, Michelf\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);
}//
}///
# ==========================================================
CI4-Strict version - Updated
download and make your system directory strict