Categories
Joomla!

Quick and Dirty Joomla install on Windows

Here are the quick and dirty steps for installing Joomla on a Windows machine.

  • Download the current released version of Joomla from http://www.joomla.org/download.html.
  • Unzip the archive file to the webserver, either in the root of the website or in the folder of your choice.
  • Identify or create the MySQL user and database you will use for the Joomla! installation.
    • Using the MySQL root account is a really bad idea.
    • Ensure that the MySQL user account has schema privileges on the database.
  • Access the folder or site on the webserver, i.e. http://localhost/joomla/ or http://www.example.com/joomla/.  Below, I'll assume you've installed it to http://localhost/joomla.
  • You'll see a series of configuration screens;
    • Choose Language:  The default is usually OK here.
    • Pre-Installation Check: Check for significant problems, click next when ready.
    • License: Click Next.
    • Database Configuration: Fill in this information as indicated.  If not sure of the database server, try 'localhost'.  Remember the caution above against using the root account, it is a serious security risk. Click Next.
    • FTP Configuration: Nothing to do here normally, just click Next.
    • Main Configuration:
      • Fill in the site name, admin email address and admin password.  (you'll be able to change these later.)  WRITE THIS INFO DOWN!
      • Installing the sample data is a good idea for new users and 'sandbox' test installations used to experiment with or gain familiarity with Joomla.  There's quite a bit of useful information for new Joomla users in the sample data.  Just click the 'Install Sample Data' button if you wish to do this.
    • Click Next when ready.
  • Now go to the webserver and delete the installation folder in you joomla website (where you unzipped the archive earlier.)  Your site won't work until this is done.
  • Now go back to your browser and click Site, or simply visit http://localhost/joomla.  You should now see your site up and running with a default template.

That's it.  Your Joomla setup is running.  You'll now want to login with the username 'admin' and the password you wrote down while filling in the installation screens.  Once you're logged in as admin, click Administrator in the resources menu and login again with the same username/password for the administrative back end of the website.  This area is not available to site visitors, event if they are members.  Only privileged accounts can log in here.  Once logged into the back end, click user manager and create a user account for yourself to experiment.  You'll want both the admin and user accounts to use if you're learning Joomla!.

Have fun!

(For those using Linux, a separate quick start guide is also available.)

Categories
Uncategorized

Plugins you Absolutely Must Have

These you just can't do without.

  • Firefox
    • Aviary: a great graphics plugin with a graphics editor and a great screen capture facility.  This thing will capture a full web page, even the parts not on the visible page, i.e. the part you have to scroll down to see!! The online editors at aviary.com are powerful and unique.  Visit aviary.com.
  • Joomla!
  • WordPress
Categories
MySQL

Cannot edit table data in MySQL Query Browser

If a table cannot be edited in MySQL, check to ensure that it has a primary key.

This can arise if a table is copied from another table – the copy will not have a primary key.

Adding a primary key will resolve the problem.

Categories
MySQL PHP

Building a dynamic SELECT list with PHP and MySQL

A common scenario in web applications is the need to create a <SELECT> list using a set of values extracted from a lookup table in a database. This article will explore a simple example of how to do that.

For this example, imagine that in our database we have a lookup table, lu_status, that holds all the possible values we will use for the status field in our form.  Imagine also the the attribute name in our form is 'status', and that our lu_status table has two attributes; status, which is the value and option_label which will be the visible label in the select control drop list. Because we might be using the <select> list in a form to edit existing records in a data table, we can also assume that the current value of the status attribute, if any, is in the variable $status.

In line 2, we create a variable, $select_status, and put the first line of the code for our select control in it.  The name 'status' in that line is the attribute name in the data table that the form will be feeding. The \n at the end of the line will cause a line break in the source code of the HTML page, making it easier to read and troubleshoot.

Line 3 is the default –SELECT ONE– value commonly used in forms when no value has previously been selected.

Lines 4-12 are where we access that database and get to work.

In line 4, we read all the possible values from the lookup table which we will use to populate our select list.

Line 5 opens a while loop which we will use to process each row that we read from the lookup table in the previous row, creating a <option> element for each.

Line 6 opens the <option> element.

Lines 7-11 are an if statement which will determine if the current value of the status attribute (if there is a current value) matches the current status attribute of the current row from the lookup table. If so, it adds the attribute selected='selected' to the option element, otherwise it creates the element without the selected attribute. In either case, the status attribute and option_label attribute from the current row are inserted into the <option> element appropriately. Each row in the table lu_status will be processed this way inside the while loop.

Now that we've build all our <option> elements, all that remains is to close the <select> control in line 13 and we're done.

Here's the PHP code;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// assemble the HTML code for the <select> list in a variable called $select_status
$select_status = "<select name='status'>\n";
$select_status .= "<option value=''>SELECT ONE</option>\n";
$dataset = mysql_query("SELECT * FROM lu_status");
while($row=mysql_fetch_array($dataset)) {
  $select_status .= "<option value='".$row['option_label']."'";
  if (strtolower($row['status']) == strtolower($status)) {
    $select_status .= " selected='selected'>".$row['option_label']."</option>\n";
  } else {
    $select_status .= ">".$row['option_label']."</option>\n";
  }
} // end while loop
$select_status .= "</select>\n";
// now insert the <select> list control into the page
echo "$select_status";

And here's the HTML code we will see generated;

1
2
3
4
5
<select name='status'>
  <option value=''>SELECT ONE</option>
  <option value='active' selected='selected'>Active</option>
  <option value='inactive'>Inactive</option>
</select>
Categories
Uncategorized

Creating an auto-forwarding web page

There are times when we want a web page to automatically redirect to another page. You may or may want to have a message displayed first.

In the first example here, the page will forward instantly, without displaying any message.

1
2
3
4
5
6
7
8
9
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="refresh" content="0;url=http://www.example.com">
    <title></title>
  </head>
<body>
</body>
</html>

In the second example, a message will be displayed with a delay before the next page automatically loads.

1
2
3
4
5
6
7
8
9
10
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="refresh" content="5;url=http://www.example.com">
    <title></title>
  </head>
<body>
<p>The following page will load in 5 minutes</p>
</body>
</html>

The key to all of this is in the content attribute on the fourth line of each example:
<meta http-equiv="refresh" content="5;url=http://www.example.com">

This attribute is in two parts, an integer followed by a URL. The integer is the number of seconds to pause, and should be set to zero if you don't want any pause at all.

If you do wish to pause before the page is forwarded, you should probably put a message in thesection as seen in the second example above.

To have a website or folder forward to another URL, just create an index.htm file with the appropriate code and place it in the website root or folder.