Please Scroll Down to See Forums Below
napsgear
genezapharmateuticals
domestic-supply
puritysourcelabs
UGL OZ
UGFREAK
napsgeargenezapharmateuticals domestic-supplypuritysourcelabsUGL OZUGFREAK

PHP question for HappyScrappy and other programmers.

George Spellwin

The Architect
Staff member
Administrator
Elite Moderator
Moderator
Our home page is in PHP www.elitefitness.com/home/index.php and we just added www.elitefitness.com/forum/hometicker.php to the home page so that we could have the most recent posts on the home page. Trouble is that it is slowing down the load time. We tried all kinds of include tags, but none worked. We had to use the object tag. Any suggestions for having posts on the home page, but not slowing the load down?
 
Wait a second... is this George Spellwin asking for "free" advice??? And after banning "Dick-in-the-ass-timothy"? :)

C
 
My guess would be either:

a) The damn marquee is what is taking forever to load, not the posts themselves. Solution would be to just list them in small font in a little box. Will take up some more room, but no one is going to sit there like a dumbass watching the threads slowly scroll by until an appealing one comes up.

b) Maybe the DB query is taking longer than it should. It should just be a simple select <blah> from <threadtable> order by thread_id/time/whatever DESC LIMIT <x> so that you select the <X> most recent threads. You sure you used a limit on the query? Otherwise if you're just using a for loop in the PHP script, you'd only use up 10, but you'd be selecting everything (I highly doubt that's the case though... too big of an error to slip by).

Can't really make any other guesses without seeing the actual code.

-Warik
 
elaborating on warik

Warik said:
My guess would be either:

a) The damn marquee is what is taking forever to load, not the posts themselves. Solution would be to just list them in small font in a little box. Will take up some more room, but no one is going to sit there like a dumbass watching the threads slowly scroll by until an appealing one comes up.very true, just have them listed instead of using the ticker, from all the sites i have seen using them i have heard nothing but pains in the ass about using that feature, and have the main page reload every 30-60 seconds so people can see the latest and greatest from the brightest here on elite lol

-Warik

ok your free reading from the psychics here at EF is over GS, time to pay for each additional sentence LOL
 
you are using the marque tag in there - last I checked that isn't supported by all browsers. it works in IE, but is generally frowned upon.

warik has a point in that it has to form that table each time, which is going to the DB and stuff - look at the load on your webserver and then look at the load on the db and see which is more stressed.
I would guess that the wait is in the DB if it is calling from all the tables... although thinking through the site design, I'd guess that there isn't a different table for each board and instead a large table with all the posts and then you can sort on that by date, and get those posts... hmm, thinking "outloud" here.
usually for a ticker like that sites use a java applet, but that would then mean they have to download the applet code and then data that it is getting... so I'm not sure that would help.

like warik said - without seeing more of the site design, the machine loads, or the code - it is hard to narrow it down.

also, since I never go to the main page, I really don't care - so it is hard for me to think too much about it :)
 
HappyScrappy said:
also, since I never go to the main page, I really don't care - so it is hard for me to think too much about it :)

Like Happy said, I never go to the main page. Boooring.

Hey Happy... let's send George an invoice for our services. bwaha

-Warik
 
my only invoice to him would be asking him to stop talking about MassQuantities around me, and he has to change his name to Irwin Lindrop because I find "George Spellwin" morally disgusting.
 
Tahe a look at the hometicker.php page. How could we just grab 10 popular posts once a day and use them until the next day? And thanks for your help.
 
George Spellwin said:
Tahe a look at the hometicker.php page. How could we just grab 10 popular posts once a day and use them until the next day? And thanks for your help.

you have a table of posts (or perhaps a table for each board - but I think that isn't the case from what it looks like).
there is a column that tracks how many posts there are on that thread.
there is a column that tracks the date the post was started, and another that tracks the date of the most recently post.
the rest really doesn't matter (unless there is already a column that shows a thread to be hot or not).

so then do a query on the database on that table (or if there are multiple tables you could either do a join or run the query on each). your query should get all the posts that have been posted on within a certain date or later (yesterday or more recent - something like that - the larger the the timespan, the more posts will be returned). and also where the number of posts is over some threshold (the higher this number goes, the fewer posts you will get).

then feed that recordset out to your page.
you could either iterate through it and dump them all out in a row, the data that you want to display (looks like thread title, poster, and make the title a link that will return that thread).
or you could have it slipt into the various boards (more work) and iterate through for each board, or more ideally iterate through once and then pull them out on an if statement or some conditional.

something like that. then inclue that page and it will build that table in the include:

<table>
<tr>
<td>
--included file-- <-- this will form a table within there. ^ the outer table will have more stuff that will shape the rest of the page, and might even be in a table itself.
</td>
</tr>
</table>

also note that all of these tables make page loads slow in themselves b/c the tags add a lot of data just to show positioning data.
 
If you could post a simplified db schema this would be easy to solve. It's hard to answer when we don't know how posts are stored in the database.
 
Top Bottom