Welcome Guest, Not a member yet? Register   Sign In
What do you think would be an efficient way to create tabular result arrays?
#1

[eluser]vtx220[/eluser]
Hello good folks of the CI forums =)

I wanted to know what do you think would be the most efficient way to display data on a webpage without having to query everything beforehand. In other words, on-demand queries.

Here's an example of how a tab could look like:
[Latest][Oldest][Most Viewed]
-------------------------------------
#This is the most recent article
#This is the second to most recent article
#this is the third most recent article


I'm sure that if this were to scale to hundreds of users at a time, it could pose a lot of CPU strain with so many queries if it were all queried at once.

THE THEORY:
The theory is that each tab would load specific controllers when clicked (or default loaded) which would then query the database for whatever the tab wants, and then output it in the container.

I'm not sure if this would work yet, but I assume that it could. However, doing it this way, is it efficient? Obviously it's a whole lot better than doing dozens of queries per page. Thoughts?


Edit: When I say "loading specific controllers" I mean it could easily be within the same controller that the current one is loaded from such as /home/index & /home/recent
#2

[eluser]InsiteFX[/eluser]
Why not use CodeIgniter's anchor tag and direct it to a method to run the query when clicked!
#3

[eluser]vtx220[/eluser]
I've never heard of that! Quick everyone, to the codeigniter user manual page!

(thanks!)
#4

[eluser]pbflash[/eluser]
Also consider that if the user switches back and forth between tabs, it will trigger a query every time they switch. So if they look at each tab twice, it's 6 queries instead of running 3 before loading the page.




Theme © iAndrew 2016 - Forum software by © MyBB