Home > Tags > PHP
Page 4

PHP Ad Tracker Part IV: Displaying and Linking Ads

In our last session, we looked at the process of entering information on ad banners and ad clients, as well as generating ad activity reports. This week, we examine how to retrieve a random banner ad. We will also learn how to delete, activate and deactivate ads and clients. The getRandomAd() function retrieves a random ad by using the PHP rand() function. The function returns the ad’s primary key ID, client ID, title, URL and redirect path. The function also updates the activity table for this banner...
Read more

How to Create and Use WordPress Custom Menus

WordPress 3.0 introduced users to a powerful feature: custom menus. Now, without the need for plugins, we can exclude, include, and rearrange our page links at will, displaying a different menu for different pages, and with some code, even different users entirely. How to Create a Custom WordPress Menu Creating a custom menu is simple. Log into your WordPress Administrative Dashboard and select “Menus” under the appearance tab. From here, select the “Menu Name” input and give your new custom...
Read more

Developing a Responsive Website Part 2: Navigation and Content

Now that we’ve got our background images squared away and set to break themselves down nicely across various devices and screen resolutions we can look in to populating our home page with some content. Let’s begin with our header. I always like using a separate file for all the things that will stay uniform throughout my site, header, logo, navigation, etc. That way if I need to make a minor edit down the road I just have to edit the header file, which is then pulled in to every page with a simple PHP include...
Read more

Developing a Responsive Website: Background Images

A while back we took A Look at Responsive Web Design and how different designers utilize it in different ways.  Now that we’ve seen a few examples in action, let’s create a responsive website of our own.  In this installment we’re going to set up the structure of our homepage and add in a few media queries that will help the site load quicker, navigate better, and keep our desired appearance across multiple devices, platforms, and resolutions. Before we dive in to the HTML, let’s cover the “viewport”...
Read more

Building a PHP Ad Tracker: Creating the Database Tables

For the vast majority of modern websites, advertising is a major source of revenue. Banner ads for services related to the web site owner’s industry allow customers to view products that tie into the site owner’s core business. In exchange, the web site owner can charge the banner ad owner for every impression (banner ad appearance) or click-through (when a user clicks the banner ad). In order to build a banner ad management system, we must first create the database tables that will hold the ad information,...
Read more

Designing a Clean Website Part 4: The Secondary Page

This week we’re going to finish up our series on how to develop a clean website by laying out a secondary page. We’re going to include a secondary navigation bar along the top of our design, as well as include all of our text for the section on one page.  This will eliminate the unnecessary loading of other pages when all that’s changing is the text.  It will allow the visitor to browse your site quicker and be less work for you to develop. When all is said and done, this is what you’ll have developed:...
Read more

PHP Arrays: Defining, Looping and Sorting Simple Arrays

Unlike scalar variables, which assign only a single value to a variable, an array variable can hold multiple values. Arrays are useful for holding values from database queries or web form entries, where each field (also called a “key”) holds a specific value. Let's take a look at how we define some of the arrays we use in PHP.Numbered Arrays. If the programmer does not specify a key for each value in the array, PHP automatically numbers the keys, starting from zero. This code defines an array $arrMonths[],...
Read more

PHP User Survey Part V: Administration Layer

In the last piece on our PHP online user poll, we look at the administrative service and how the site supervisor enters, deletes and manages the poll data. The first poll administrative page checks if the administrator is logged in. You can choose from Session variables or Cookies to check the site administrator login status. Once the application has confirmed the identity of the site administrator, the page lists the available polls. The first step is to use the class methods and variables in the class.polls.php...
Read more