Explore the Premium Content

Dreamweaver MX 2004 PHP Server Behaviors

In today's tutorial we will be taking a look at creating a log in system using PHP Server Behaviors. Our system will provide an admin area for creating/editing and deleting users from the system, as well as the log in system itself. We'll be working with the newly released Dreamweaver MX 2004 for this article, as this will give us the opportunity to work with the new user authentication Server Behaviors that have been introduced with MX 2004.

After reading this tutorial, you'll be able to:

1. Create a table of users who could log into the site, along with their respective user access levels 2. Create a login page that authenticated users against that database table using the Log In User server behavior 3. Use the Restrict Access To Page server behavior, along with some of our own code to redirect authenticated users to the correct areas of our site 4. Use the Restrict Access To Page server behavior with defined access levels to make sure that only Admin users could access the admin section of the site 5. Use the Master-Detail Page Set application object to create a structure for the admin pages.

Read More

The ASP.NET Cache Object

In "classic" ASP many developers used the Application object as a cache. They stuck everything from single variables to the whole files in there, and when they updated the information, they then forced a refresh of the entire Web application to update the Application object. Not only was this like a using a sledgehammer to crack a nut, it was a memory intensive way of doing thing and the more junk that was accumulated in the application object, the more sluggish your web server would become.

The Cache object is a large feature addition to ASP.NET and seems to have been hidden away in the documentation. Despite initially appearing daunting, there's no reason why anyone can't use it. This is a tutorial on how to add and remove items from the Cache object both implicitly and explicitly, using the dependencies or timestamp expiration policies which mean that you can force the contents of the cache to be expired and then reload them if either a specific date/time is reached, the timestamp on a file changes, or if an item inside the cache itself changes.

Read More

Creating a Dynamic News Feed in PHP

In this article we look at how to create a dynamic news feed. By delivering the content of the feed as JavaScript, it can be incorporated easily into any site, as the feed is gathered by the user's browser and so does not need any special software on the host's server.

We then look at reading records from a MySQL database, putting the results in an array so that the data can be worked with easily later on in our code. We create a custom function to display a number of characters from a string, without splitting the string in the middle of a word. By making the number of characters to display a parameter of the function, we made it general- purpose, so that it can be used easily on other sites to save time in the future. We then look at displaying the news data using JavaScript.

Finally, we create a page that read a parameter from the pages URL, and uses it to select a record from the database, and we display this data on the page, so that a visitor can read the whole of their selected news item.

Read More

Grabbing an RSS Feed with PHP

A great way to add content to your site is use syndicated content from blogs, news sites etc with RSS which is Rich Site Summary (some would say Really Simple Syndication, or RDF Site Summary), and is a format used by a variety of sites for content syndication.

This tutorial uses PHP to grab the feed and incorporate it into our site. As it stands we can't do this in Dreamweaver, so we'll make a PHP script and then turn it into an extension so that you can re-use it on other pages. The PHP requires some existing understanding to make sense of, so this tutorial will be hardwork (but not impossible) for PHP newbies.

Read More

Working with Session Variables in PHP

In this tutorial, we look at using Session Variables in PHP, to store user information as a user moves backwards and forwards through the pages of a website. This allows information to be tied to a user, linking them to records in a database to create a shopping cart (for example). Session Variables are also commonly used for security systems, so that once a user has logged in their status is held in a Session Variable.

The first section that we examine is how Session Variables work, and how to enable them in PHP if they're not already enabled. We then look at how to store a value in a Session Variable, and how to avoid the common "Headers already sent" error that can occur, and how it can be stopped permanently by using Output Buffering.

We then look at how to read back a Session Variable and how to check whether a Session has been set or not. Finally, we look at when to use Session Variables and when to use Cookies, and how to destroy a Session Variable.

Read More

ASP.NETconfiguration

Asp.net configuration has changed massively from the classic ASP days of pointing and clicking using IIS and altering the odd settings dynamically via the Server or Response objects. We delve into the new configuration settings stored as XML files and look at how to change them and what exactly they contain.

Read More

Backing up MySQL Databases made easy with PHP

In this tutorial, we use PHP as a scripting language to backup a number of MySQL databases so the files can either be downloaded over the web, or are automatically sent to a remote server by FTP. We then create a script which automatically restored the files again, with a minimum of manual intervention.

The system is ideal if you host your own clients, and makes it easy to make sure that all the information in your databases is regularly backed up. The system can be extended further by creating a nice web interface to the backup system, and access can be given to your clients so they can backup their own databases allowing you to offer them a better service.

Read More

ASP.NET User Controls

Chris explains the vision and the advantages of ASP.NET user controls - write once, use anywhere routines that modularise your development and helps seperate the back-end development team's work from the front-end 'design' work.

The example built up in this tutorial will prove very useful to over-worked developers; an ASP.NET user control that can be used on every page in a site to insert a rotating advertisment header (sourced from an XMLfile) and a copyright notice footer. The source code can be freely adapted and used in your own sites.

Read More

Idea to implementation: Password protect the Admin site and Use PHP Upload

In this article, Matt continues his write up of his brief to build an artists' portfolio site. The customer requires an administration area of the site to upload, delete and rename images that are displayed on the front-end of the system. Matt teaches you how to build a password protected admin area using PHP and MySQL, and teaches you how to use the PHP Upload Extension to allow uploading and management of the image files.

Read More

PHP Regular Expressions Made Easy .. well, easier.

Regular Expressions often crop up on people's list of programming stumbling blocks. Whether in PHP, JavaScript or Visual Basic, their power for searching and replacing is eclipsed only by the user-unfriendliness of the syntax.

In this tutorial, Allan demonstrates the use and the syntax of Regular Expressions via the familiar interface of the Dreamweaver MX Find and Replace dialogue box, builds up a list of the must useful RegEx syntax and then applies in his Dreamweaver code.

Read More

PHP advanced text functions: These are a few of my favourite strings

In this tutorial we look at the things that PHP can do with string variables, investigating how we can search for bits of a string, grab specific pieces out of a string and how we can split a string up into smaller bits - vital functionality if you are coding a function to manually parse a CVS file, for example.

This article is suitable for beginners to intermediate level Dreamweaver MX PHP users, but we work with some PHP functions that aren't exposed through the Dreamweaver MX environment and so will be hand coding most of the examples.

Read More

Dreamweaver MX and PHP Recordsets explained

In this tutorial, we delve under the covers of Dreamweaver MX, and look at how the PHP Recordsets actually work.

Many times in the Macromedia Dreamweaver MX forums there are questions on how to connect to a MySQL database, and how to work with Recordsets, so we're going to look at them in depth and explain how to use values from a recordset in your own code.

Knowing how the Dreamweaver MX generated code works is the first step to hand coding, and allows you to break down the constraints imposed by the Server Behaviors, and create more complex functionality for your websites.

Read More
Newer articles Older articles