views:

76

answers:

1

Hello

As you probably all know Code Igniter can assign pseudo variables using the Parser library, but you also know that if we want to assign a Pseudo Variable to use it in a View, we have to do it in every controller that loads those views with the pseudo variables.

I would like to know if Code Igniter 1.7.2 has some way that i can assign a Global Pseudo variable (like the pseudo variables from the Benchmarking Class).

The pseudo variables i want, would have simple data mostly returned from the $config array in the config.php file.

If some could help me with that.

Regards.

A: 

I just looked in the source code for the benchmarking and output classes.

These variables are specifically replaced by the output class, so without modifying it or extending it (and rewriting some methods) you are obliged to use the template parser, or stick to normal PHP method.

If you're really set on doing it, you could write a library and use a hook to do a find/replace just before the output class finishes.

Kurucu
@Kurucu: Probably the best would be to extend the Controller library, once views have the need for controllers. Don't you think?
Fábio Antunes
Ah yes, a much cleaner method! Override perhaps Controller::load::view().
Kurucu