Start learning with our library of video tutorials taught by experts. Get started

Dynamic Dreamweaver Websites: Creating and Validating Forms

Using include files


From:

Dynamic Dreamweaver Websites: Creating and Validating Forms

with Candyce Mairs

Video: Using include files

We are going to look at a concept called Includes and every server side language has a way to include files. So what we're going to do is build that concept from scratch in a quick example to show you what an Include is. So let's create a new PHP page. I can do that by clicking Create New, right here. What we're going to do is save this file, this is going to be saved as header.PHP. So just the word header.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Dynamic Dreamweaver Websites: Creating and Validating Forms
3h 34m Intermediate May 19, 2011

Viewers: in countries Watching now:

Forms perform an essential function in modern websites, making it possible to gather information from users and validate that information. In this course, Adobe Certified Expert Candyce Mairs shows how to create forms to email user information and validate user data using various methods of form validation. These validation methods include client-side, server-side, and custom validation; CAPTCHA images; and Spry validation fields. You'll also see how to set up a PHP testing environment and preview PHP pages in Dreamweaver. Along the way you'll build your skills in areas like using admin consoles, commenting code, working with variables and includes, and much more.

Topics include:
  • Installing XAMPP on a Windows system
  • Installing MAMP on a Mac system
  • Using admin consoles
  • Creating PHP pages
  • Commenting code
  • Working with web forms
  • Adding custom validation
  • Using redirects
  • Dealing with email issues
Subjects:
Developer Web Web Design Web Development video2brain
Software:
Dreamweaver
Author:
Candyce Mairs

Using include files

We are going to look at a concept called Includes and every server side language has a way to include files. So what we're going to do is build that concept from scratch in a quick example to show you what an Include is. So let's create a new PHP page. I can do that by clicking Create New, right here. What we're going to do is save this file, this is going to be saved as header.PHP. So just the word header.

Now ultimately what we want to do is use this page as an Include. So, I am going to delete all of the HTML code on this page. So just select all of the code and delete it. So we are going to insert an image onto this page to pull in as our header. So I'm going to go up to the insert bar, Choose Image, and we don't have too many in here to choose from, so it's pretty obvious which one we want. We'll include our header image from our images folder.

And in the Alt text, I'm just going to say header image. I'll make it short and sweet for now. 'Cuz we're actually not going to be using this specific page within our website. So all we have is an image tag dropped onto this header.PHP page. If I go into DesignView, you can see that's our header image for our Scuba Vacations website. So I will save that page. Now how do I use this page? I'm going to create another new PHP page by going to File New > Blank Page > PHP.

Make sure none is selected and click Create. Now this page, I'm going to save as, oh let's name this one Ad Include. So here's our header. What I want to do is get that image showing up on this page, and I can use PHP to do that. So I need to put my cursor exactly where I want that to be pulled in, that image, and I want it inside the body tag. So what I'm going to do is let PHP pull it in. So I'll go up to the PHP tab in the Insert bar. I'm going to select my code block and that is where my Include's going to go. Now, I'll put this on a separate line.

You don't have to. I just think it's easier for you to see what I'm doing if I do that. So this could all be on a single line, and to include a file I'm going to say include and parentheses. Now I still have a coding error here. What we need to do is end our statement with a semi colon. Now the idea is in between these parenthesis we want to put what we want to include. Since this is in the same folder our header image is inside the same folder as our Ad include. I don't need to specify any type of a path, so what I do is put between single quotes I am going to put the name of the page, so I just put header.PHP. I will put a comment in here and we'll put in header image I'll save that page, and let's take a look, at what PHP does to our page, if we preview it in the browser.

There's our image, and it's just as if it was originally sitting on the page. If I go out to view page source. You'll see it's literally just as if it's on the page. Directly under the body tag, it pulls it in. Now the way the page is read, is top to bottom left to right, so it starts reading it, and PHP is going to be reading this and processing only this portion inside the code block. So PHP says okay, I need to go out, find this file, and pull the code in, and put it right where this PHP code block is.

So that's why we saw the image tag directly underneath the body tag. The benefit of this, is I can use an Include on every page within my website and later on if I want to update my header image I am able to do it just by changing this single file. Every page from that point on once I upload this new header.PHP would have that information inside of it. So this single page could update across my entire website very easily.

I only need to upload one new file instead of every page within my site. So you can see the power of an include. So for our Scuba Vacations website, what we are going to do is bring in the header image, which is what you're looking at. And a nav bar, in a header page so the nav bar code would go in the same area. We're also going to have a footer we're going to pull in at the end of the page comment.

That way, within my actual pages, I only need to focus on the content for the page. So that is a PHP Include, and how to work with them. What we want to do is use that concept to build a template page for our website so every time we need a new page for the site we just pull in that template file and we have our header and footer automatically added by PHP.

There are currently no FAQs about Dynamic Dreamweaver Websites: Creating and Validating Forms.

Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dynamic Dreamweaver Websites: Creating and Validating Forms.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked