Page 1 of 1

Browser is overworked

Posted: Mon Jun 09, 2008 3:49 pm
by Kevin415
I am working on a website using PHP. I am creating a personel directory and I am working on adding anchors. I have already added the anchors for each letter of the alphabet, but as I add anchors to the end of each alphabetical listing, the browser takes longer to load the page and if I put too many anchors in the browser stops completely. Is there some setting that I need to look at changing to allow this page to work properly.

Re: Browser is overworked

Posted: Mon Jun 09, 2008 4:33 pm
by Weirdan
what browser exactly? Firefox, Opera, Safari, Konqueror, Links, something else?

Re: Browser is overworked

Posted: Tue Jun 10, 2008 10:01 am
by Kevin415
Sorry, the browser i am using is Internet Explorer and FireFox.

Re: Browser is overworked

Posted: Tue Jun 10, 2008 3:57 pm
by califdon
Kevin415 wrote:I am working on a website using PHP. I am creating a personel directory and I am working on adding anchors. I have already added the anchors for each letter of the alphabet, but as I add anchors to the end of each alphabetical listing, the browser takes longer to load the page and if I put too many anchors in the browser stops completely. Is there some setting that I need to look at changing to allow this page to work properly.
I can't visualize what you are doing. Post the code where you are adding anchors (and please follow Forum Rules viewtopic.php?f=6&t=30037 in enclosing code snippets between [ code=php] and [ /code] tags, for readable displays).

Re: Browser is overworked

Posted: Wed Jun 11, 2008 9:12 am
by Kevin415
Ok, here are the some of the inital anchors (these of course go from A-Z):

Code: Select all

echo "<a name='top'></a>";
echo "<a href='#A'>A</a> ";
echo "<a href='#B'>B</a> ";
Now the following code is for the letter "A" and at the bottom(in blue) is the anchor to go back to the top. As I have stated prior to adding the anchor tags this page displays fine, but after i start adding the anchor tags to refer to the top of the page, my page starts bogging dow.

Code: Select all

    echo "<div class='section'><h2><a name='A'>A</a></h2>";
    for ($i = 0; $i<count($lnamesA); $i++){ 
        $sql = "SELECT * FROM pdir WHERE pid =".$lnamesA[$i];
        $result = mysql_query($sql);
        $row = mysql_fetch_array($result);
        
        if ($i%2 == TRUE){
            $col = 'R'; 
        }else{
            $col = '';
        }
        
        echo "
<div class='person".$col."'>
    <div class='pdirLeft'>
        <img src='{$row['picURL']}' alt='Photograph of {$row['lname']} {$row['fname']}' border='1px' />
    </div>
    <div class='pdirRight'>
        <div class='name'>{$row['lname']}, {$row['fname']}</div>
        <div class='line'><span>Title:</span> {$row['title']}</div>
        <div class='line'><span>Office:</span> {$row['office']}</div>
        <div class='line'><span>Phone:</span> {$row['phone']}</div>
        <span>Email:</span> {$row['email']}
    </div>
</div>";
        
    } [color=#0000FF]echo "<div class='pdirAnc'><a href='#top'>Back to Top</a></div>";[/color] // anchors back to the top of the page.

Re: Browser is overworked

Posted: Wed Jun 11, 2008 1:26 pm
by califdon
I don't think your problem is with your anchors, it's probably with the process you're using, apparently for each letter of the alphabet, running a query against a database. I'm not clear on what you are doing there. If you are using a different CSS class for each letter of the alphabet, what is different that requires a different class? That part is unfamiliar to me. Other than that, the anchors are pretty standard and should cause no slowing. But certainly if you are performing 26 queries in PHP, just to generate your HTML, a slow server might cause a slowdown.