Backend StructureBackendWhile developing complex web applications using Macromedia UltraDev and PHAkt, it soon became obvious that the backend is one of the most expensive parts of a web site in terms of time. One of the causes that led to this was the lack of cohesion between design and application logic, a problem that still exists in Dreamweaver MX. For example, when initially implementing a form using Dreamweaver, you need to individually create 3 separate pages for Inserting, Deleting and Updating data in your database. Moreover, the application logic (especially the validation) would have to be reproduced at least 6 times (client-side logic and server-side logic on each of the 3 pages). Now let us go back to our KTMLtutorial publishing application. The structure of our CMS is a very simple one: a left frame containing the menu and a right one containing the information. The access to this page is done through the admin/index.php file, a simple PHP login script that validates the user login data. First of all, create a new folder in the site root, called admin. This folder will hold all pages for the administration area of the site. Login PageBefore you build the login page, add a user called admin with password admin in the database. Create two files: index.php and loginfailed.php. Open index.php. This will be the login file. Before applying the Log In User server behavior, you must create a form. In the form insert a table with two rows, two columns and a submit button. In the newly created table insert two text fields (set their names to usr_name and usr_pass) and two labels (Username and Password). Change the login button label to Login from the property inspector. The form should look like this:
Now go to the Server Behaviors panel and select the User Authentication->Log In User server behavior. Select the Login User tag from the Server Behavior window and the following setup window will appear. Select the form fields containing the login variables, the connection used and the database tables containing the registered users and their passwords. Also, you will have to indicate the actions to be done in the case of successful or failed validation. In this case, a successful login will point to the admin.php page while a failed login will point to loginfailed.php page.
As you can see in the screenshot, we choose admin.php if the login succeeds. This page will be the frameset used for administration area. Admin FramesetA frameset document is an HTML document that describes a frame layout, more precisely the size, position and functionalities of frame documents composing the frameset. This concept was created as a response to the increased need to publish more information in a more organized, and in the same time easy to read, form. HTML frames offer designers a way to keep certain information visible, while other views are scrolled or replaced. The main difference between a classic HTML document and a frameset is the replacement of the <body> tag with <frameset>. Create a frameset like you did for the frontend. The frameset name should be admin.php (the page chosen previously if login succeeds). Name the left frame menu.php and the right frame content.php. Note: do not forget to set up the document type for menu.php and admin.php. Menu FrameAlthough many web designers do not recommend the creation of a separate frame for a navigation menu, we have chosen this option due to the simplicity. This frame will contain a menu.php file, which includes links to users and site contents configuration pages. All the HTML <a href =””> tags include a target=”mainFrame” option. This option specifies the frame in which the targeted document will be displayed. In the KTMLtutorial website, the main frame is the right frame (or the content frame), while the left frame is called leftFrame. Create 2 links according to the picture: the first one, Users, should point to user.php and the second one, Pages & Articles should point to page.php (do not forget to set target=”mainFrame” for every link).
Now, under Pages & Articles, write Logout. Select the text, go to the Server Behaviors panel and choose User Authentication->Log Out User. Configure logout according to the screenshot:
Content FrameThe file content.php is a blank page used just for the frameset creation. The information about users and pages will be displayed in the user.php and page.php files. |
Adobe acquired InterAKT
InterAKT has been acquired by Adobe.
Learn more
|