CodeIgniter Forums

Full Version: Dan's SimpleTags: Keyed data-array not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]mvdg27[/eluser]
Hi guys,

In the readme of Dan Horrigan's SimpleTags library it is mentioned that data from the data-array can be fetched as such: {foo:bar} .. However in my tests I wasn't able to achieve this behaviour.

Consider the following code:

Code:
$data['foo']['bar'] = 'Test value 1';
$data['foobar'] = 'Test value 2';

$content = '{foo:bar} {foobar}';

$this->load->library('tags');
$this->tags->set_trigger('trigger:');
$parsed = $this->tags->parse($content, $data);

This produces "{foo:bar} Test value 2", in other words, the first tag {foo:bar} is not being parsed correctly. I wasn't able to debug everything entirely, but I did found that the function '_parse_data_single', which is supposed to take care of these kind of tags, is never called.

Is it a bug? Or am I doing something wrong? Any help is greatly appreciated!

-Michiel

El Forum

[eluser]Mr. Pickle[/eluser]
I've never used this library but I think the set_trigger function wants you to set the trigger.
So it will probably be:

Code:
$this->tags->set_trigger('foo:');

Again, this is a quick reply I don't have the time yet to test it.