Archive for April, 2008

outputStory($row[ article_id ], TRUE); } } require_once footer.php ; ?> 2. (Photoshop web design)

Sunday, April 20th, 2008

outputStory($row[ article_id ], TRUE); } } require_once footer.php ; ?> 2. On any page with a search box on the top, enter a word that existed in the article you created. Once you submit the form, search.php will appear, and any matches should be shown. How It Works First, you include the necessary files:

Search Results

n ; if ($result and !mysql_num_rows($result)) { echo

No articles found that match the search terms.

n ; Otherwise, loop through the results and display them as snippets on the screen: } else { while ($row = mysql_fetch_array($result)) { outputStory($row[ article_id ], TRUE); } } require_once footer.php ; ?> 478 Chapter 13
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Web page design - if (mysql_num_rows($result) == 0) { echo No

Wednesday, April 16th, 2008

if (mysql_num_rows($result) == 0) { echo No published articles available ; } else { while ($row = mysql_fetch_array($result)) { echo
n ; echo . htmlspecialchars($row[ title ]) . (published . date( F j, Y ,strtotime($row[ date_published ])) . )

n ; echo

n ; } } Then load the footer. It is only a few lines of HTML for now, but some day you will want to put a menu, or perhaps a copyright line. The great thing is, even if your site uses 300 pages, you will have to add that information in only one place: footer.php. ?>

Try It Out Search The final thing you are going to add is a simple search feature. Using the power of the full-text searching in MySQL, you can easily put a keyword search field on each page, and show the results here. 1. Create search.php:

Search Results

n ; if ($result and !mysql_num_rows($result)) { echo

No articles found that match the search terms.

n ; } else { while ($row = mysql_fetch_array($result)) { 477 Building a Content Management System
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Pending Articles This code gets all pending articles

Tuesday, April 15th, 2008

Pending Articles

This code gets all pending articles written by this user. They are ordered by date_submitted, with the oldest being first. Please note that if there are no pending articles, this will not return a MySQL error. You will still get a result set, but there won t be any rows. You handle that contingency next. No pending articles available ; } else { You loop through each pending article and display the title (with a link to the article), along with the date/time it was submitted. while ($row = mysql_fetch_array($result)) { echo
n ; echo

n ; echo

n ; } } Okay, this next code is almost identical to the code used to display pending articles. This time, display them using the date_published column. We recommend high quality webhost to host and run your jsp application: christian web host services.

How It Works Now let s (Cheap web hosting) take a look

Monday, April 14th, 2008

How It Works Now let s take a look at cpanel.php. The Control Panel page cpanel.php is used to allow users to change their usernames and e-mail addresses. They can also see all of the articles they have written, categorized by Pending and Published articles. As always, you need to connect to the database. And, as always, conn.php takes care of that. This time, you are displaying a Web page. You load up header.php, which is your standard header for all Web display pages. require_once conn.php ; require_once header.php ; You first go out to the database and get the user s name and e-mail address. $sql = SELECT name, email . FROM cms_users . WHERE user_id= . $_SESSION[ user_id ]; $result = mysql_query($sql, $conn) or die( Could not look up user data; . mysql_error()); $user = mysql_fetch_array($result); You will be entering and exiting PHP mode throughout this file and in the other Web pages. This gives you great flexibility and makes the page a lot easier to read. The next line exits PHP code: ?> The following form uses the post method. Notice the action. You already created that file. You know that when a submit button is clicked on this page, transact-user.php loads, the appropriate code runs, and the user is redirected to the control panel.
Note the use of htmlspecialchars(). This prevents strange characters such as < or > from messing up the page. These characters will be displayed using their entity equivalents (such as < and >).

Name:
>

The rest of the form is standard HTML. Now you need to display Pending and Published articles. Time to drop back into PHP:

Email:
>

475 Building a Content Management System
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Cool web site - $row[ article_id ] . > . htmlspecialchars($row[ title ]) . (published

Sunday, April 13th, 2008

$row[ article_id ] . > . htmlspecialchars($row[ title ]) . (published . date( F j, Y , strtotime($row[ date_published ])) . )

n ; echo

n ; } } ?>

. htmlspecialchars($row[ title ]) . (submitted . date( F j, Y , strtotime($row[ date_submitted ])) . )

2. On the navigation links, click Control Panel. You should see a screen similar to the one shown in Figure 13-11. Here you can change your user information (user name and e-mail), and see what articles you have written for the site. Figure 13-11 474 Chapter 13
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Cheapest web hosting - Pending Articles Published Articles

Saturday, April 12th, 2008

Pending Articles

No pending articles available ; } else { while ($row = mysql_fetch_array($result)) { echo
n ; echo

n ; echo

n ; } } ?>

. htmlspecialchars($row[ title ]) . (submitted . date( F j, Y , strtotime($row[ date_submitted ])) . )


Published Articles

No published articles available ; } else { while ($row = mysql_fetch_array($result)) { echo
n ; echo
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Display all the (Best web design) current comments for this article

Friday, April 11th, 2008

Display all the current comments for this article on this page:

And that s it! They re getting easier, aren t they? Stay with us only a couple more short ones. That last one was a doozy, huh? Additional CMS Features So far, you ve created a system to create and manage users, and publish articles, but there are a couple additional features that can help make your CMS a lot more usable and manageable. What you re going to add is the ability for users to update their information, and the ability to search published articles by keyword. Try It Out User Control Panel In this exercise, you re going to create a page so users can maintain their own information. 1. Enter the following code, and save it as cpanel.php:

Name:
>

Email:
>

472 Chapter 13
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Free php web host - You may notice that you don t worry about

Thursday, April 10th, 2008

You may notice that you don t worry about the situation in which an article is not passed. As it stands, if you load viewarticle.php without the article parameter in the URL, you will simply get a page that consists of the site title, search, and a menu (all included in header.php). The rest will be blank. If that s the desired result, then that s fine. You may decide to redirect the user back to the home page if $_GET[ article ] is empty. If you do, don t forget to include http.php and use redirect() before header.php. The next page is comment.php. Include the necessary files:

Add a comment

A simple text area is used to enter a new comment:

Comment:

The next bit deals with the submit button and a hidden field for the article ID. This is needed to send the article ID to the next page:

>

471 Building a Content Management System
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

outputStory($_GET[ article ]); showComments($_GET[ article ], TRUE); require_once footer.php ; ?> 2. Now, (Jetty web server)

Thursday, April 10th, 2008

outputStory($_GET[ article ]); showComments($_GET[ article ], TRUE); require_once footer.php ; ?> 2. Now, create comment.php:

Add a comment

Comment:

>

3. Go back to the index by clicking the Articles link. Click the Full Story link below the snippet of the article you want to view. The full article should appear, complete with a link to add comments. How It Works The first page, viewarticle.php, is very short, yet it illustrates the nature of included files and functions wonderfully. As you can see, there is no content displayed directly with viewarticle. It simply includes the necessary files and uses two functions to display the article and all of the comments. 470 Chapter 13
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Web design seattle - echo n ; if ($row[ is_published ]) { $buttonType = Retract ;

Wednesday, April 9th, 2008

echo

n ; if ($row[ is_published ]) { $buttonType = Retract ; } else { $buttonType = Publish ; } Now add the edit button. This allows the user to edit the article: echo ; Add the Retract or Publish button, used to retract a published article, or publish a pending article. Only moderators and admins are allowed to retract and publish articles. if (($row[ access_lvl ] > 1) or ($_SESSION[ access_lvl ] > 1)) { echo ; } Next insert the Delete button, used to remove articles. The Delete code in transact-article.php currently allows only pending articles to be deleted. echo ; ?> And they all lived happily ever after. The End. >

Feeling a little d j vu? Good. Try It Out Article Pages So you ve created an article, reviewed it, and published it. Now it s time to give the public a way to view the article and provide feedback. 1. Create viewarticle.php: If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.