• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to load in custom library in ci4

#1
I was trying to load custom libraries in ci4 to try and implement smarty with ci4 as we do in ci3 has anyone here try and be succeeded.

If ci4 don't allow me to use smarty template engine I stuck with ci3.
Reply

#2
You should be able to load it, but it will need to be in it's own namespace.

The namespace can then be loaded into CI4 autoloader.

.app/Config/Autoload.php
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(11-01-2019, 08:38 AM)InsiteFX Wrote: You should be able to load it, but it will need to be in it's own namespace.

The namespace can then be loaded into CI4 autoloader.

.app/Config/Autoload.php

I have tried to look into the Autoload.php this the library will be load in Classmao?
Reply

#4
Looks like Smarty is not using namespaces, so you just have to include the file. You could use the Classmap for autoloading and that should work, I think. But, since you'll know where you're storing it in your app, there's no need for that, just include the file as you would any other PHP file.

Per their crash course:

PHP Code:
include('Smarty.class.php');

// create object
$smarty = new Smarty
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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