Easy PHP Scheduled Content
A lot of sites have some sort of scheduled / delayed content system to help stockpile posts so you don’t need to work every day or at the very least have to manually submit the posts when you want to. I’ve seen sites use cron jobs to handle this feature but the easiest way is to use your existing date column for the content.
With most content tables, you will have a published date column so the user can see when the content was written or submitted. Use this column to your advantage for scheduled posting. Using the simple database setup below, we will create scheduled posts.
Speeding Up Your Website
Having your website load and perform actions quickly is very important. Users don’t want to wait for a page to load. If they feel like your site is taking a while to load they will often navigate back and find another search result and visit that site instead.
What can you do about slow loading websites or to speed up your current site? Below is a list of items you should check through and perform. Also at the end of this post will be some resources you should check out.
Code Compression
When delivering large amounts of code to visitor to your website, you want it to be downloaded fast so the rest of your site can load smoothly. For instance, since CSS is usually one of the first render-blocking files that the web browser has to request and parse before the rest of the site loads, you’ll want this file to be as small as possible. Modifying your CSS file to be more optimized, such as combining rules, creating global classes and more can help reduce repeated CSS throughout your style-sheet. Along with optimizing your CSS and JavaScript, you should also compress your code.
Handling Purchased File Downloads
Making it so your website can handle file downloads is very important now-a-days. Either it be when you are giving out your free CD or if you want to distribute your software. The above two are simple, you simply link to a public location where the file is accessible. But what if you want users to buy your software or music? Now it gets a little more interesting.
The first obvious solution is to find a service that handles this, such as iTunes or a software distributor. But if you want a system built into your own website, we can help you.
PHP Prevent Include Direct Access
It’s good practice to limit where your website visitors can go so they don’t get into trouble or cause problems with your site. Although, problems should occur when they directly access a file they are not supposed to, sometimes you can’t help it.
Below is a very simple way to prevent your users from directly accessing important system files for your website.
What you have to first do is identity a file that all pages use and include. Most sites now have a single “index.php” file which is used to parse the URL and then load the appropriate content. If that’s the case with your website, you will want to use index.php in this tutorial. If your website is using a more classic approach of having each webpage as a different file, you can use a file you include on every site such as “header.php”, but keep in mind that this file will not be protected like the others. Also note that this has to be the first file you include.