Closed vishal-px closed 6 years ago
I got the solution. This is a correct library code.
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$path = __DIR__ . "/../third_party/php-liquid-compiler/liquid/";
$loader = require $path . 'vendor/autoload.php';
$loader->addPsr4('Liquid\\', $path . 'src/Liquid');
use Liquid\Liquid;
use Liquid\Template;
use Liquid\Cache\Local;
class Phpliquidcompiler
{
public function phpLiquid($html = NULL){
Liquid::set('INCLUDE_SUFFIX', '');
Liquid::set('INCLUDE_PREFIX', '');
Liquid::set('INCLUDE_ALLOW_EXT', true);
Liquid::set('ESCAPE_BY_DEFAULT', true);
$liquid = new Template();
$liquid->parse('{% assign special= "" %} {% if special != "" %} <div><a
href="">[special]sdsdsd</a></div> {% endif %}');
echo $liquid->render();
}
}
?>
Hi @harrydeluxe
Thanks for this package. I have used this package in my localhost and its working fine. Now I want to use this package in CodeIgniter, so I have added this package at this path "application/third_party/php-liquid-compiler/liquid". And now I have created a library for using this package.
Here is my library code, This code inside in "application/libraries/".
Calling above code from controller.
Will you please tell me where I am wrong ?
Thanks.