|
|
#1 |
|
New to PHP - very basic question.
I've tried finding an answer for this but to no avail. Maybe it's just too basic.
I've decided to finally learn some basic php to use with my website. The dynamic bits of the website I want are: 1) Header 2) Side menu 3) Footer. So, VERY basic. Now, when I enter what I consider the most basic code into Dreamweaver MX 2004, it gives me the yellow code warning saying I'm wrong. I haven't even started with the sidebar yet! This is what the three files contain: Header File Code:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>This is a test page</title> </head> <body> <p>This is a header</p> Code:
<? include("header.php"); ?>
<h1>This is the first page</h1>
<? include("footer.php"); ?>
Code:
<p>This is a footer</p> </body> </html> Is it? Or is Dreamweaver wrong? If I view the page in IE, Safari or Firefox it works fine but I don't like the idea of starting off with wrong code. I know this is the most basic of questions but I can't find an answer online that makes sense. Like I said, I just started learning!
__________________
13" Macbook Pro 2.9GHz, 8GB RAM, 750GB HD |
|
|
|
0
|
|
|
#2 |
|
The code looks fine, and Dreamweaver isn't the best at rendering php, so I'm not sure...
You could try to use the full PHP Code:
PHP Code:
(I just use TextWrangler for all my php scripting, I think Dreamweaver is a bit overkill unless you want to use templates and set up a site for Contribute editing ).I also always insert an empty PHP Code:
__________________
Those who fail to learn history are doomed to repeat it; those who fail to learn history correctly... why, they are simply doomed. |
|
|
|
0
|
|
|
#3 |
|
Thanks for that.
Dreamweaver is overkill, I agree. And it often over-complicates things! I'm just used to doing my html and css in it but I'm starting to discover php isn't its forté. Well, I'm content that I'm not wrong. Thanks for that. I feel better now.
__________________
13" Macbook Pro 2.9GHz, 8GB RAM, 750GB HD |
|
|
|
0
|
|
|
#4 |
|
Taco HTML Edit supports PHP preview, if you want something a with a bit more functionality than a text editor...
![]() Both that and TextWrangler are free... and highly recommended...
__________________
Those who fail to learn history are doomed to repeat it; those who fail to learn history correctly... why, they are simply doomed. |
|
|
|
0
|
|
|
#5 |
|
Thanks Mitthrawnuruodo!
I'm a whore for freebies and Taco HTML Edit looks perfect. I have enough confidence in my HTML now to not require a "see as you type" situation and this looks perfect. Thanks!
__________________
13" Macbook Pro 2.9GHz, 8GB RAM, 750GB HD |
|
|
|
0
|
|
|
#6 |
|
You may also consider using require() instead of include(). This will force your "content" PHP script to die if it can't include the header and footer.
This would be consistent with many of your required html tags (<html>, <head>, <title>, <body> to name them all) being in included files. If the files arn't included, well the html page doesn't really exist ![]() This will be totally transparent for you and your visitors, and will help debugging (say, you forget to ftp the header and footer...). Also, don't forget document type declaration (here or here). ![]() But this is maybe the next lesson.
__________________
InvisiSig™: "The day Microsoft makes something that doesn't suck is the day they start making vacuum cleaners." -Unknown "And it eats 8088s for breakfast." -Steve Jobs |
|
|
|
0
|
|
|
#7 |
|
Yes, upon further reading I've decided require () is the better way to go. And I had included the HTML declarations but not in this post. So I kind of lied. Not everything was included.
![]() On Day 2 of learning php, I just want to get this right in my head. php is really just saying "go to this file and enter this info here" so, in theory, a php file could nothing but the following code: Code:
<h1> I'm here for the sake of it</h1> PHP Code:
So using the above example, if I wanted to change the the heading to say: Code:
<h1>This is new</h1> Am I on the right track? Php.net I just found too overwhelming! So I'm just taking little baby steps for now.
__________________
13" Macbook Pro 2.9GHz, 8GB RAM, 750GB HD |
|
|
|
0
|
|
|
#8 | |
|
Quote:
__________________
Oct 2011: check out my band's first album @ boxsetauthentic.com |
||
|
|
0
|
|
|
#9 |
|
Hooray!
First CSS and now php! My "now learn this" exercises are proving fantastic! Sadly my 100+ portfolio website would have benefitted greatly from php. Ah well, I'll fix that up one rainy day....
__________________
13" Macbook Pro 2.9GHz, 8GB RAM, 750GB HD |
|
|
|
0
|
|
|
#10 | |
|
how do i post a message
Quote:
Hi can you tell me how i can enter my own post? i'm new here and not sure how to do this. thank you selena
|
||
|
|
0
|
|
|
#11 | |
|
Quote:
-Chasen |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| New to MobileMe - Email syncing question. | thereitis | iPhone | 3 | Jul 1, 2009 05:43 PM |
| new to mac - PS Elements questions | 615bride | Digital Photography | 3 | Apr 19, 2009 12:44 PM |
| New to Mac - Few basic Qs | CaptainCocoPop | Windows, Linux & others on the Mac | 17 | Nov 26, 2008 09:15 PM |
| Yes, brand new to Mac - a few questions probably useful to anyone! | WirelessInn | Mac Basics and Help | 34 | Jun 23, 2007 08:03 PM |
| New to Apple - Very Disappointed | cb31 | Mac Pro | 73 | Jul 9, 2006 10:36 AM |
All times are GMT -5. The time now is 02:28 AM.







).

Linear Mode

