nsForum logo

Welcome Guest ( Log In )

 
Reply to this topicStart new topic
> Increase Your Php / Mysql Performance!
Corey
post Jun 15 2009, 10:26 AM
Post #1


Network Solutions Technical Support


Group: Administrators
Posts: 173
Joined: 23-June 08
Member No.: 1,316



If your PHP/MySQL site takes long to load, or process requests there are some things you may do outside of script optimization.

  • Make sure you are using the server's local host name and not the IP address for the connection string. (i.e. mysqlvX instead of 205.178.146.XX)
  • Optimize your MySQL tables by use of a PHP script or PHPMyAdmin. You can even make a scheduled task to do this on a daily basis in your account manager!



If anyone else has any tips please feel free to post a reply!
Go to the top of the page
 
+Quote Post
twistedvengeance
post Dec 19 2012, 11:20 PM
Post #2





Group: Verified NS Member
Posts: 5
Joined: 19-December 12
Member No.: 19,671



If you are using a lot of javascript and css, it is best to call them at the end of the page. Example:
CODE
<html>
    <head><title>Page Title</title><head>
    <body>
        <div>
            <div>
            </div>
        </div>
        <script src="template/js/file1.js"></script>
        <script src="template/js/file2.js"></script>
        <script src="template/js/file3.js"></script>
        <script src="template/js/file4.js"></script>
        <link src="template/css/file1.css" />
        <link src="template/css/file2.css" />
        <link src="template/css/file3.css" />
        <link src="template/css/file4.css" />
    </body>
</html>


Also, if you are using a very large image to be a background, do not make a 1920x1080 image of it and use that for all resolutions. Make one at 1080, 720, 480. Then use:
CODE
<html>
    <head>
        <style> #header{ background: none; } </style>
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                if(((window).width() <= 1080) && ((window).width() >= 720)){
                    $("#header").attr("style","background: url('template/img/header1080.png');");
                }
                if(((window).width() < 720) && ((window).width() > 480)){
                    $("#header").attr("style","background: url('template/img/header720.png');");
                }
            });
        </script>
    </head>
    <body>
        <div id="header"></div.
    </body>
</html>
Go to the top of the page
 
+Quote Post
ecomIanS
post Aug 24 2014, 11:35 PM
Post #3





Group: Administrators
Posts: 967
Joined: 14-January 13
From: Jacksonville, FL
Member No.: 19,888



QUOTE (twistedvengeance @ Dec 20 2012, 12:20 AM) *
Also, if you are using a very large image to be a background, do not make a 1920x1080 image of it and use that for all resolutions. Make one at 1080, 720, 480. Then use:
CODE
<html>
    <head>
        <style> #header{ background: none; } </style>
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                if(((window).width() <= 1080) && ((window).width() >= 720)){
                    $("#header").attr("style","background: url('template/img/header1080.png');");
                }
                if(((window).width() < 720) && ((window).width() > 480)){
                    $("#header").attr("style","background: url('template/img/header720.png');");
                }
            });
        </script>
    </head>
    <body>
        <div id="header"></div.
    </body>
</html>


Good suggestion, but really you'd want to just do that using CSS instead of PHP code by implementing a media query(s).

Here's an example:
CODE
@media (max-width: 768px) {
.header {
background: url('bg-768.jpg);
}
}

@media (max-width: 480px) {
.header {
background: url('bg-480.jpg);
}
}
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
Tags
No Tag inserted yet

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version    Network Solutions © 2011 Time is now: 26th July 2017 - 07:26 AM
Domain Names | Web Hosting | Web Design | Shopping Cart Software | Online Marketing | SSL Certificates