Welcome Guest, Not a member yet? Register   Sign In
Dynamically loading content within a view
#1

[eluser]onecurlyfry[/eluser]
Hey all -

I'm currently loading 8 rss feeds into panel style divs on my page. I then aggregate those feeds into various arrays, passing them into googles charts/graphs API to return 4 charts in panel style divs as well.

I have a controller on my page that handles most of the logic. After logic, model calls/data returning, etc the last line in that controller is:

$this->load->view('layout', $data);

(I use $data['content'], $data['footer'], $data['header'] etc... then in the view I simply say something like <?=isset($content) ? $content : ''?> to display content)

Ultimately, what this means is when you load this page, there's 5-6 seconds of a blank screen prior to the page loading in its entirety. What I'd like to do is load the layout initially, then add an ajax-style "loading" gif over the panels. As each panel loads, the content would display and the ajax loader would be removed.

It's similar to any mashup/widget style site I'm sure you've all seen before.

I have no problems loading the ajax loader & hiding it when the panel is loaded. What I don't know is how to do this with CI.

Obviously I need to load the view first. I just don't know how to set the hooks (non-CI hooks I expect) to fire off the PHP code to load each of the panels. Are they separate views, in and of themselves? Do I load them as a string:

$data['twitter'] = $this->load->view('twitter', $rss_twitter, true);

How do I pass them back into the view?

I'm sure this is simpler than I'm giving it credit for, I'm just stuck right now. Your help is appreciated.

Scott


Messages In This Thread
Dynamically loading content within a view - by El Forum - 10-12-2010, 12:17 PM
Dynamically loading content within a view - by El Forum - 10-12-2010, 12:38 PM
Dynamically loading content within a view - by El Forum - 10-12-2010, 01:26 PM
Dynamically loading content within a view - by El Forum - 10-12-2010, 03:03 PM
Dynamically loading content within a view - by El Forum - 10-12-2010, 07:18 PM
Dynamically loading content within a view - by El Forum - 10-12-2010, 10:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB