Welcome Guest, Not a member yet? Register   Sign In
Access to Session vars from within Output.php
#1

[eluser]haydenp[/eluser]
Hi

I'm looking to replace the native Output.php (caching) library with my own custom library (minor tweaks required to the native library).

I understand the reason behind not having access to
Code:
$CI =& get_instance();
from within the library ... however, I need to get hold of my session vars from within my custom Output.php library ... is this possible ... or similar to get_instance(), is the session instantiated later, after the caching?
#2

[eluser]TheFuzzy0ne[/eluser]
Perhaps you might be better off writing your own version of the session class, that can be used without CodeIgniter. It should be simple enough I think.
#3

[eluser]haydenp[/eluser]
Thanks for the reply FuzzyOne.

That would be an option ... but personally I'm not overly keen to resort to making "wholesale" changes just to get Output.php to do what I want at this stage. The change I need to make to Output.php is so minor that I'd hate to make changes to other libraries etc.

Your idea is on my "short list" if all else fails. Thanks.

What I'm trying to achieve here is:

Each page is written to the cache and read from the cache based on a unique page name. This unique page name is based on the md5() hash of the full pages url. I need to take this a level further and add an extra level of "uniqueness" by adding an ID to the unique page name. The ID I would like to add is held in the session.

Currently _write_cache() and _display_cache() use the following to generate their unique page name

Code:
$unique_page_name = md5('the full URI here');

What I need is ...

Code:
$unique_page_name = $CI->session->userdata('the unique id I would like to add') . '-' . md5('the full URI here');

Note: In _write_cache() one does have access to "$CI =& get_instance();" so I can get to my session vars, but it is not available in _display_cache()
#4

[eluser]haydenp[/eluser]
FuzzyOne

After trying a few modification and taking a closer look at the Application Flow Chart I think the only option would be to run with your idea ... but I'll leave that for a rainy day!




Theme © iAndrew 2016 - Forum software by © MyBB