Welcome Guest, Not a member yet? Register   Sign In
codeigniter and iframe
#1

[eluser]tim1965[/eluser]
Hi

Sorry in advance if this is more of a PHP issue than CI. I am calling a seperate page (i.e. outside of CI, but within the same domain) from my view that loads a table based on a user id. I get the ID from the login and store it in the session. However the external page is not seeing the session data property. If i var_dump the property from the external page it just returns the variable name as if the property has not been set. So i am wondering if i need to explicitly pass this and if so how do i do this using iframe.

Any help will be most appreciated
#2

[eluser]pistolPete[/eluser]
CI does not use native php sessions. It uses its own Session class.
Either you adjust your "external page" to read that session or use this extension: http://codeigniter.com/wiki/Native_session/
#3

[eluser]tim1965[/eluser]
Thanks for the reply.

I know CI uses its own session. What i am trying to do is pass a variable with value of the session property to the target iframe.

So in my controller i get the value and place it into a variable. I pass this to the view. However the view just redirects to the target iframe. So my problem is passing the variable from the view to the iframe.
#4

[eluser]Phil Sturgeon[/eluser]
Can you pass it as a GET parameter to the iframe?

In your view:

Code:
<iframe src="http://example.com/page?val=<?=$this->session->item('whatever');?>" />
#5

[eluser]xwero[/eluser]
Have you already tried something like
Code:
$user_id = $_COOKIE['ci_session']['logged_id'];
#6

[eluser]tim1965[/eluser]
Phil

That works. Thanks for your help.




Theme © iAndrew 2016 - Forum software by © MyBB