
It consists of tags to build the structure of the website. HTML stands for Hypertext Markup Language. It only requires client side languages like HTML and CSS to build the website. It's a basic type of website and doesn't have custom coding or dynamic features. What is the difference between static and dynamic website - comparison of the main differences key termsĪ static website is a website with fixed content, usually written in HTML. What is a dynamic website - definition, functionality 3. What is a static website - definition, functionality 2. Static websites are simple websites with no custom coding and databases, while dynamic websites display different content and are more complex and interactive. Websites can be either static or dynamic. HTML, CSS, and JavaScript are the three basic languages used in web development. The process of designing and building a website is known as web development. It helps them communicate with their customers. You could even store timestamps in the cached file itself to get over the issue of some cache files will need to be updated hourly, others monthly.The main difference between static and dynamic website is that a static website is a simple website with fixed content, while the dynamic websites are advanced websites that serve different content based on customer needs.Įvery organization maintains websites. A way to get around this would be to read the time that the cache file was created and say something along the lines of "If the file was created less than 3 days ago, use the cached file, else, build a new cache file from the database and overwrite the old one.
Static and dynamic website examples update#
The problem with this simple approach is that if you update a page in the database, the cache file won't be updated with it and people will therefore be viewing out-of-date pages. This way, if a cache file doesn't exist, it'll use the SQL database to generate the page (as it does now) and then it'll make a cache file so that it won't have to look at the database next time someone tries to the view the page, because when the page is viewed again, it'll just read the data from the cache file and skip out all the database queries.

Static and dynamic website examples code#
Obviously simplified somewhat, you'd need some code to actually generate_cache_file and to readfile properly, but you get the gist. It's extremely easy to implement and you'll get human-readable URLs for free.

You don't waste time generating HTML for pages that nobody sees, and you ensure that your content is always updated daily.

You can go for bonus points by having your http server setting cache control headers to set the expiration to "tomorrow" to reduce the number of requests for even your cached resources. That approach will have your site serving up HTML for many/most pages which should be more-or-less as quick as it can get. Have your server rewrite requests to /x/y/z.html to index.php?c=$1&g=$2&page=$3 if a file at /x/y/z.html doesn't existĬonfigure your application to write the HTML generated for requests to index.php?c=X&g=Y&page=Z at /x/y/z.htmlĬonfigure your applicaiton not to write HTML for things that must not be cached (for example "my profile" pages on forums are generally not suitable caching).Ĭonfigure a cron job to purge pages from disk every day (or whatever). I have a index.php?c=X&g=Y&page=Z wich basicly make my whole website but as I want to save some mysql load, I would like to make them static like No no, not mod_rewrite as it's still make mysql queries.
