This series of the videos explains how to create Photo Gallery using PHP, MySQL, ImageMagic and jQuery. Using PHP you will be able to add, modify and populate data stored on the MySQL Database and display records of all images on the page. ImageMagic will help us to resize and crop images to the relevant dimentions, while jQuery will provide the support in the presentation of the gallery. The last two chapters are dedicated to adding the earlier created gallery to our Content Management System. Over 4 hours of videos!!!

Dreamweaver tutorials

 
  • Link Exchange System with Dreamweaver CS3
  • Edit Category Page

In this chapter I will show you how to create Edit Category page.

Open category_edit.php file located in your admin folder.
Apply template by coing to Modify > Templates > Apply Template to Page. Select admin_temp and click Select button.

Apply template in Dreamweaver CS3
Fig. 174

In Code view overwrite the line which says:

<p id="ptitle">Title Placeholder</p>

with the following:

<p id="ptitle">Edit category</p>

In the Server Behavior tab of the Application panel click + sign and from the list of options choose Recordset (Fig. 175).

Create recordset in Dreamweaver CS3
Fig. 175

In the Recordset window choose:
Name rsCategory
Connection conndb
Table tbl_categories
Columns All
Filter catid > = > URL Parameter > id
Sort None
(Fig. 176)

Recordset window
Fig. 176

Click OK and save the file.

In the Code view remove the paragraph which reads <p>Content Placeholder</p> and leave the cursor in its position instead.
Change view back to Design and in the Data tab of the Insert panel choose Record Update Form Wizard (Fig. 177).

Record Update Form Wizard
Fig. 177

In the Recordset Update Form window choose:
Connection conndb
Table to update tbl_categories
Select record from rsCategory
Unique key column catid
After updating, go to category_add.php

In the Form fields section select catid and remove it by clicking - sign.
Select catname and in the Label field overwrite the existing value with Category name:. Leave the rest as default and click OK to add Record Update Form to your page (Fig. 178).

Insert Record Update Form in Dreamweaver CS3
Fig. 178

Now let's format our form and table. First place your cursor anywhere inside of the table and click <form#form1> selector (Fig. 179).

Form tag
Fig. 179

On your keyboard press Ctrl+T.
Replace id="form1" with id="forminsert" and press Enter on your keyboard
(Fig. 180).

Change id of the form tag
Fig. 180

Now select your table by placing your cursor anywhere inside of the table and clicking the <table> selector (Fig. 181).

Edit table tag
Fig. 181

In the Properties panel choose:
Table Id tblinsert
CellPad 0
CellSpace 0
Border 0
Align Default
(Fig. 182)

Table Properties
Fig. 182

Select Update record button and press Ctrl+T.
Place your cursor after value="Update record" and type id="button".
Press Enter on your keyboard and save the file (Fig. 183).

Apply id to the submit button
Fig. 183

Now place your cursor in the first cell of the first row and press Ctrl+T on your keyboard twice.
Replace td nowrap="nowrap" align="right" with th and press Enter to apply changes (Fig. 184). Do the same with the cell underneath.

Change table cell into table header
Fig. 184

Change view to the Code and identify the line which reads:

<table border="0" cellpadding="0" cellspacing="0" id="tblinsert">

Place your cursor at the end of this line and press Enter on your keyboard to create a new line.
On new line type:

<caption>Edit category</caption>

Identify the line which reads:

<th>Category name:</th>

and change it so it reads:

<th><label for="catname">Category name:</label></th>

One line down, in the input field, after name="catname" type id="catname" and save the file.

Change the value of the input field from:

value="<?php echo htmlentities($row_rsCategory['catname'], ENT_COMPAT, 'utf-8'); ?>"

to:

value="<?php if (isset($_POST['catname'])) { echo $_POST['catname']; } else { echo htmlentities($row_rsCategory['catname'], ENT_COMPAT, 'utf-8'); } ?>"

Now identify the line which reads:

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {

Create a new line by placing your cursor at the end of this line and pressing Enter on your keyboard.
On newly created line type:

if ($_POST['catname'] == "") {
$mess = "<p>Please provide category name.</p>";
} else {

Identify the line which reads:

header(sprintf("Location: %s", $updateGoTo));
}

and after the closing curly bracket place another one so it looks like this:

header(sprintf("Location: %s", $updateGoTo));
}}

Now identify the line which reads:

<caption>Edit category</caption>

and create a new line.
On new line type the following:

<?php if(isset($mess)) { ?>
<tr>
<td colspan="2" class="messagebox"><?php echo $mess; ?></td>
</tr>
<?php } ?>

Our validation is done.
Again, we can add the focus on the input field by adding the following after
<!-- InstanceBeginEditable name="head" -->:

<script type="text/javascript">
<!--
onload=
function getFocus()
{
var toFocus = document.getElementById("catname");
toFocus.focus();
}
//-->
</script>

Test your file by pressing F12 on your keyboard.

Now let's move to the last chapter of the second part of this tutorial where I will explain how to restrict access to pages by applying one of the Dreamweaver's built in Server Behaviors.

<< Add Category Page | Restrict Access to Page >>

 
  • Thank you for subscribing to our newsletter.
  • To complete registration please click on the link in the email which has been sent to you.
  • Invalid first name
  • Invalid last name
  • Invalid email address

Website Design Company | Website Design Company Sussex | Website Design Company Chichester | Website Design Packages
Tutorials Resources | Articles | Contact | Vector
© Web Design Tutorials – Sebastian Sulinski