0
votes

I'm developing a properties module for Expression Engine that's to take properties from Rightmove's BLM format and populate a database, and then those properties be searchable from the front-end.

I've found a CodeIgniter library (http://biostall.com/codeigniter-rightmove-blm-parser-library) that does the heavy lifting of the BLM files. However, I can't seem to load it.

My code in mcp.properties.php looks like this:

$config = array();
$this->EE->load->library('rightmove_v3_parser');
$this->rightmove_v3_parser->initialize($config);
$data['properties'] = $this->rightmove_v3_parser->process();
print '<pre>'; print_r($data['properties']); print '</pre>';
exit;

The library files are in a libraries sub-folder in my properties add-on folder under /system/expressionengine/third_party/.

However, when using the above code, I get the following error in Expression Engine:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Properties_mcp::$Rightmove_v3_parser

Filename: properties/mcp.properties.php

Line Number: 44

Fatal error: Call to a member function initialize() on a non-object in /Users/Martin/Sites/expressionengine/system/expressionengine/third_party/properties/mcp.properties.php on line 4

Where am I going wrong? Why can't I bundle this library with my add-on and call it within my add-on?

2

2 Answers

1
votes

You've missed the EE object when referencing the library. So after loading the library you should use

$this->EE->rightmove_v3_parser

to access it, rather than

$this->rightmove_v3_parser
0
votes

Have you included the library at the top of your plugin, i could be wrong but I don't think loading a library like that will work from a library subdir in your third_party plugin folder. Try including the library at the top of your plugin.