Landitus
Landitus

Reputation: 1900

Is it possible to access codeigniter functions/helpers from within Magento?

I have a Codeigniter powered site at the root and a Magento powered product catalog inside a catalog folder. I was wondering if it is possible to load Codeigniter inside Magento so I can re-use partials, helpers, etc.

For example: I would like to share the same header in both platforms, so the header.php file in Codeigniter uses the url helper, and functions that Magento doesn't understand

How can I achieve this?


UPDATE: I've tried the following:

CODEIGNITER
    |
    \_ CATALOG (Magento)

Inside Magento's index.php file I added:

include('../index.php');

$CI =& get_instance(); 
echo $CI->load->controller('welcome');

After this, I got an error "Can't find application folder" from Codeigniter when loading site/catalog. So something worked. I cheched this other SO question and inside Codeigniter index.php file I added:

$application_folder = dirname(__FILE__)."/application";
$system_path = dirname(__FILE__)."/system"; 

The first error was gone but then followed 5 php errors where it could not find CI/UTF8.php, CI/URI.php, CI/Benchmark.php... etc. These are CI core files which are referenced in the bootstap index.php.

This is where I'm stuck...

Upvotes: 2

Views: 445

Answers (1)

Anton S
Anton S

Reputation: 12750

Have you tried to include your class files to your header templates and call the methods from external lib objects? Or better jet include already outputted header file?

Upvotes: 0

Related Questions