943,868 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 887
  • PHP RSS
Apr 28th, 2009
0

Help Required to reduce website load time

Expand Post »
HI,
I am developing a new website..The design is sowhat over .My problem is its taking too much time to load.I need a very simple interface but i ended up in this bottle neck .I used jquery to add some effects ..

Do u have any suggestion to reduce the page load time or any suggestion in making the site more interactive

the link to the page is http://www.shefeekj.com/WhiteLove/
Reputation Points: 1
Solved Threads: 2
Light Poster
shefeekj is offline Offline
37 posts
since Apr 2009
Apr 28th, 2009
0

Re: Help Required to reduce website load time

Usually for a page to take that long to load, it is due to one or more loops taking too long to process or even a slow mysql server. So post the script for index.php and I will check what modifications need to be done.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Apr 28th, 2009
0

Re: Help Required to reduce website load time

here is the code for the page.php .... its in called in an iframe from index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cool AJAX MENU</title>
<script type="text/javascript" src="niftycube.js"></script>
<script src="jquery.min.js" type="text/javascript"></script>
<script>
// When the document loads do everything inside here ...
$(document).ready(function(){
Nifty("#menu a","small top transparent");
Nifty("#outcontent","medium bottom transparent");
$('.content').load('boo.php'); //by default initally load text from boo.php
$('#menu a').click(function() { //start function when any link is clicked
$(".content").slideUp("slow");
var content_show = $(this).attr("title"); //retrieve title of link so we can compare with php file
$.ajax({
method: "get",url: "boo.php",data: "page="+content_show,
beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
success: function(html){ //so, if data is retrieved, store it in html
$(".content").show("slow"); //animation
$(".content").html(html); //show the html inside .content div
}
}); //close $.ajax(
}); //close click(
}); //close $(
</script>
<style type="text/css">
body { margin:0 auto 0 auto; color:#000; font-family:Georgia, "Times New Roman", Times, serif; font-size:16px; background-color:#666666; }

.page { margin:100px auto 0 auto; width:750px;}

#menu { list-style:none; margin:0px; padding:0px;}

#menu li { list-style:none; display:inline; }
li.active a { background-color:#FFF;color:#000; }

#menu li a,#menu li a:link { float:left; background-color:#3c3c3c; margin-right:5px; padding:7px; color:#FFFFFF; text-decoration:none; width:6em; text-align:center;}
#menu li a:visited { }
#menu li a:hover { background-color:#327cc8 }
#menu li a:active { background-color:#FFF;color:#000; }



.content {
background-color:#FFF; background:url(ajaxinterface.jpg) bottom right no-repeat; padding:10px; height:300px; margin:0px; }

#loading { clear:both; background:url(wait.gif) center top no-repeat; text-align:center;padding:33px 0px 0px 0px; font-size:12px;display:none; font-family:Verdana, Arial, Helvetica, sans-serif; }

#outcontent {clear:both; background-color:#FFFFFF; }

</style>
</head>

<body>

<div>
<ul id="menu">
<li id="Back"><a href="" title="about">Page Rank</a></li>
<li id="portfolio"><a href="#" title="portfolio">Back Link</a></li>
<li id="contact"><a href="#" title="contact">WHOIS</a></li>
<li id="keyword"><a href="#" title="keyword">Keyword</a></li>
<li id="meta"><a href="#" title="meta">Meta</a></li>

</ul>
<br style="clear:both;" />
</div>
<div id="outcontent">
<div id="loading">LOADING</div>
<div class="content"></div>

</div>
</body>
</html>
Reputation Points: 1
Solved Threads: 2
Light Poster
shefeekj is offline Offline
37 posts
since Apr 2009
Apr 28th, 2009
0

Re: Help Required to reduce website load time

I have just checked the code and although the html is fine an all the ajax is a real mess. I think the following section will need a rewrite and although it is hard to see what this piece of code does, I think some tutorials might help find a better way of doing it.
PHP Syntax (Toggle Plain Text)
  1. <script>
  2. // When the document loads do everything inside here ...
  3. $(document).ready(function(){
  4. Nifty("#menu a","small top transparent");
  5. Nifty("#outcontent","medium bottom transparent");
  6. $('.content').load('boo.php'); //by default initally load text from boo.php
  7. $('#menu a').click(function() { //start function when any link is clicked
  8. $(".content").slideUp("slow");
  9. var content_show = $(this).attr("title"); //retrieve title of link so we can compare with php file
  10. $.ajax({
  11. method: "get",url: "boo.php",data: "page="+content_show,
  12. beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
  13. complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
  14. success: function(html){ //so, if data is retrieved, store it in html
  15. $(".content").show("slow"); //animation
  16. $(".content").html(html); //show the html inside .content div
  17. }
  18. }); //close $.ajax(
  19. }); //close click(
  20. }); //close $(
  21. </script>
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007
Apr 28th, 2009
0

Re: Help Required to reduce website load time

thanks a lot for the reply .. i am searching for a better option to do this ..trying to rewrite the code too....i will post the tutorials if i get a better option
Reputation Points: 1
Solved Threads: 2
Light Poster
shefeekj is offline Offline
37 posts
since Apr 2009
Apr 28th, 2009
0

Re: Help Required to reduce website load time

simplify your code. use functions and try to use the the common code in separate file and include that at required place. Apply OOPs and try to apply efficient quires.
Reputation Points: 16
Solved Threads: 48
Posting Whiz
BzzBee is offline Offline
327 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: xml with php
Next Thread in PHP Forum Timeline: Recommendation?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC