Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
An important but little-understood concept in dynamic web development is that of role-based logins, which allow different types of users to access different parts of the site. In this course Adobe Certified Expert Candyce Mairs shows how to use Dreamweaver's features to create role-based logins, restrict page access, build an administrator area, and test everything to make sure it works. Plus, see how to set up a development environment and work with a database from within Dreamweaver. Along the way, build your skills in areas like working with PHP, adding form validation, using server behaviors, and much more.
I now have a page called Creative Variables, and this page was built in the Create Variables movie, and what we want to do is display information on the page. So right now, if I put this in the browser, nothing is displayed. The space is created in computer memory. Those values are stored. Now, how do we get them onto the page? Well, what were going to do is use a command in PHP that tells PHP to write to the page and that command is Echo.
And what I'm going to do is say Echo, dollar, hello. Now, notice in my code hints that pop-up because I created this variable up here, Dreamweaver understands that variable has been created. This is another, new CS5 and 5.5 feature. And I can work with it that way. I'm also going to say dollar sign world. Once it's showing, I hit Enter or Return, add my semicolon, and that should display our information.
Let's check it out. Now, this is saying there's a syntax error on our page, so let's take a look at what it does in the browser. And you can see, there is definitely a syntax error in our code, and these are not the easiest to understand in terms of what it is PHP wants you to do. However, you can kinda start reading some of these. It looks like it's expecting something. Well, we know that there's a semicolon at the end of the line. What's wrong with this piece is the quote feature.
Let's see what happens if we add double quotes. And now it says, no syntax error. So, even though, it's a variable. We still, in order for PHP to be happy, we must put anything after Echo inside of double quotes and you can see my name is being printed. Now, what if I want to change these values? I don't want it to be my specific name, I want it to say, Hello World, once again.
I'll change the value. The value is on the right-side of the equal sign. So this is the information that goes inside that drawer is going to change. But I don't need to change this line in order to do that. So I'll Preview. Now, it says Hello World. So the value is being displayed whatever the value is at that point in time. And that's the basis of all variables in any type of language. Be it client-side language, server-side language, programming language or scripting language.
A variable exists in all of those, so anytime you want to display a variable Echo is what you tell PHP. Now, we used the code block here in the PHP tab to create the code block. Let me show you another feature Dreamweaver has. And I'm going to put it into a separate code block, because I want to show you this complete piece. Just to the right of the code block is Echo, but when you use Echo, it prints out the opening and closing PHP code block plus it says Echo.
And when you go to do this, I click withed my cursor. Let me show you. See how the cursor is right in the spot where you can start typing. So this Echo is a little bit more complete. If you need to output information to the page, this adds the code block and the word Echo and adds the space. So, all you have to do is click that, and start typing what you want to put in here. Now, get rid of those, you can see the red error. It isn't happy, because there's a word, Echo, and just like up here, we don't have the double quotes on each side of what we want to display.
So that is how you display a variables in PHP. Now, that concept transfers whether I want to display it in a table, whether I want to just split it in the middle of a sentence. It doesn't matter. In the middle of a form field. Echo is how you tell PHP print this out to the page. You can think of it like printing it as HTML. So that is displaying a variable in PHP.
There are currently no FAQs about Dynamic Dreamweaver Websites: Creating Login Areas.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.