Welcome Guest, Not a member yet? Register   Sign In
Everytime my template is called, run this...
#11

[eluser]nZac[/eluser]
@bigtony,

Definitely a possibility and I thought of that (and will be what i do if I can't cache it), but often users of the site refresh often and I would like a to 'cache it' in some way so that I do not have to call that function a lot and waste resources but can rather just output the html generated when the user logs in.

Thank you for all your suggestions thus far!
#12

[eluser]Zack Kitzmiller[/eluser]
why not use the session variable to call a view?

Code:
<div class="sidebar">
  &lt;?php
       $this->load->view('sidebar-' . $this->session->userdata('sidebar_number'));
  ?&gt;

</div>
#13

[eluser]nZac[/eluser]
[quote author="nZac" date="1257822114"]
One possibility would be to compile a sidebar file, name it (some random string ) and then store then name in the Session. When the session is deleted the users sidebar would be deleted as well.

Thoughts?[/quote]


[quote author="techneke" date="1257885719"]why not use the session variable to call a view?

Code:
<div class="sidebar">
  &lt;?php
       $this->load->view('sidebar-' . $this->session->userdata('sidebar_number'));
  ?&gt;

</div>
[/quote]

Do that?
#14

[eluser]bigtony[/eluser]
[quote author="nZac" date="1257884870"]...but often users of the site refresh often and I would like a to 'cache it' in some way so that I do not have to call that function a lot and waste resources but can rather just output the html generated when the user logs in.[/quote]
Maybe CI's [url="http://ellislab.com/codeigniter/user-guide/general/caching.html"]Caching facility[/url] might do the job for you. Or if not, you could set a session variable that is set to TRUE after the first dynamic load for the user and then test that variable on each subsequent refresh, only re-generating the sidebar if it's FALSE.
#15

[eluser]Zack Kitzmiller[/eluser]
[quote author="nZac" date="1257886004"][quote author="nZac" date="1257822114"]
One possibility would be to compile a sidebar file, name it (some random string ) and then store then name in the Session. When the session is deleted the users sidebar would be deleted as well.

Thoughts?[/quote]


[quote author="techneke" date="1257885719"]why not use the session variable to call a view?

Code:
<div class="sidebar">
  &lt;?php
       $this->load->view('sidebar-' . $this->session->userdata('sidebar_number'));
  ?&gt;

</div>
[/quote]

Do that?[/quote]

Yeah, I would. Assign the number (or whatever) of the view you want into a session variable (that's what they're for..), then load the view with that number.

That will work fine. You can load views from a view.
#16

[eluser]nZac[/eluser]
@bigtony, is their a way to regulate what is cached and what is not cached?

@techneke, if I can't get this cache thing to work, I will do it that way.

@phil Sturgeon, At first look, this is exactly what I am looking for, I will let you know if I add something that way you could use it as well!

I will let you all know what happens tonight when I work on this!




Theme © iAndrew 2016 - Forum software by © MyBB