Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Working with includes

From: Dynamic Dreamweaver Websites: Creating Login Areas

Video: Working with includes

We are now going to take a look at one of the server side language major benefits. Not using HTML, but using PHP, we have access to something called an Include. And I think the easiest way to show what an Include does, is to actually create one, and use it. So what I would like to do, is create a new PHP page. Were going to name this page. We'll Save it. And lets name it as image.

Working with includes

We are now going to take a look at one of the server side language major benefits. Not using HTML, but using PHP, we have access to something called an Include. And I think the easiest way to show what an Include does, is to actually create one, and use it. So what I would like to do, is create a new PHP page. Were going to name this page. We'll Save it. And lets name it as image.

Let's just call it image.php. And we will drop an image onto our page. I'll put it between the body takes. So I'm going to go up to Insert Image. And we don't have too many images inside of here, I will take the Footer image as an example, and click OK. Our Alt text, will be called footer. So all we have, on this page, is a footer right now.

I'll Save this page. If we go back to code view, what I want is to get rid of everything but the image coding. So I only have an image showing in the browser. But I still have a lot of extra coding. So I'm going to delete everything except that image tag. I'll Save that file, and we now have that available as an image. How do I work with that, on another page? Let's create another new page, this time I'll use this new interface, and you can see Ctrl+N is the shortcut on the PC side, Cmd+N on the Mac.

And you get into the blank page interface, so we want to just start from the left and work your way across to the right. So we want a blank page that page typed as a PHP, we do not want any layout features on it, and I'll click Create. There is our page. So we have a blank page right now. what I want to do is bring this file into this page. So how do we do that. I'm going to make a space and we'll go back to the PHP tab.

Now this tab does have a couple of features here. They look somewhat similar because they are, there are four different ways to include a file. We're going to use the simplest. So I will create a PHP code block here, make some space so you can see what I'm doing. PHP does not require you to do this. I'm just doing it so you can see the line of code, that I will be working in. I will click the Include file, or the little flappy up here and notice when I did that, that included the PHP code block with it. So since I'm not going to be creating anything else I'll get rid of our first code block.

So Echo adds the code block and the word Echo the include does the same. you're getting the code block as well. Now, what do we want to include, we want to include Image.PHP. It says, no syntax errors, let's Save this page, we'll save this as Display Include. I'll click Save, and we'll put this into the browser. Now I'm having a little bit of an issue here, and it's telling me in both errors that line 10 has a bit of a problem. Now our syntax said there wasn't a problem.

So just because this no syntax says there isn't a problem, what it's looking at is the basics structure of your code. But our include word needs single quotes here, and I'll grab this and drag it in between the two. Notice now, once again. I have no syntax errors. Let's see what this does in the browser. I'll Save that one. And there is our footer. So it's important to understand that you can't get to dependent upon this syntax errors.

It is still possible to have errors that will show up in PHP even though Dreamweaver's trying to assist you. Because Dreamweaver is looking at the basic structure and the characters of your PHP, but PHP may require extra. So, we'll close that up, and that is how you work with an Include. So, make sure, you just have to get used to when it's an Include, you use single quotes on each side. Now, what would happen if I used double quotes? I know you want to know, so let's try it. And it did add a second one for me.

There we go. It says, no syntax errors. We'll put it in the browser. And it displays just fine. So in this example for an include, I think most of the time, you will see includes use a single quote. There is a subtle difference between these quotes and PHP. I'm going to use Ctrl+Z or Cmd+Z to step backwards in time and let Dreamweaver replace that for me. So I don't have to go in and fix it. But that is how you can work with an Include.

What we want to do, is begin to use this process across all of our pages. We can use this for our header and footer images within our website. That way, if we decide to change our Header Image, I only need to change one file. So we'll take a look at building a Template Page for our website in order to do that moving forward.

Show transcript

This video is part of

Image for Dynamic Dreamweaver Websites: Creating Login Areas
Dynamic Dreamweaver Websites: Creating Login Areas

43 video lessons · 1598 viewers

Candyce Mairs
Author

 
Expand all | Collapse all
  1. 1m 32s
    1. Welcome
      1m 32s
  2. 2m 57s
    1. Course overview
      1m 16s
    2. The course environment
      1m 41s
  3. 26m 58s
    1. Static vs. dynamic requests
      4m 8s
    2. Installing XAMPP on a Windows system
      8m 54s
    3. Installing MAMP on a Mac system
      4m 29s
    4. Using admin consoles
      3m 54s
    5. Installing the course files
      5m 33s
  4. 18m 36s
    1. Overview of the Dreamweaver interface
      6m 22s
    2. Setting up the course site
      6m 20s
    3. Previewing pages
      5m 54s
  5. 33m 38s
    1. Creating PHP pages
      5m 45s
    2. Adding PHP code
      5m 44s
    3. Displaying variables
      4m 45s
    4. Commenting your code
      5m 30s
    5. Working with includes
      5m 58s
    6. Building the course templates
      5m 56s
  6. 35m 13s
    1. What is a database?
      5m 2s
    2. Adding database tables
      7m 34s
    3. Connecting to the database
      8m 28s
    4. Getting data from a database: Part one
      8m 25s
    5. Getting data from a database: Part two
      5m 44s
  7. 1h 16m
    1. Planning the login process
      7m 25s
    2. Creating a login form
      7m 45s
    3. Adding form validation: Part one
      9m 22s
    4. Adding form validation: Part two
      1m 37s
    5. Exploring the registration page
      7m 17s
    6. Correcting table fields
      6m 1s
    7. Setting up the login landing page
      4m 1s
    8. Using server behaviors
      3m 36s
    9. Inserting new members
      8m 48s
    10. User authentication
      10m 3s
    11. Restricting access to pages
      5m 17s
    12. Testing the login
      4m 53s
  8. 1h 6m
    1. Admin area overview
      5m 9s
    2. Adding new users
      5m 19s
    3. Restricting access
      12m 25s
    4. Planning the admin update area
      5m 19s
    5. Building the members table listing
      6m 55s
    6. Building the querystring
      9m 14s
    7. Populating the update form
      6m 33s
    8. Updating the database data
      11m 28s
    9. Testing the admin update process
      3m 47s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

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.


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.

Join now "Already a member? Log in

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 Login Areas.

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
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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

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
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.