View Single Post
Old 01-12-2008, 12:33 PM   #7 (permalink)
andrew247
Google Guru
 
andrew247's Avatar
 
Join Date: Oct 2005
Location: c:\GoogleCommunity
Posts: 3,386
Thanks: 3
Thanked 13 Times in 13 Posts
andrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of light
Simple page output:
PHP Code:
<?php
// This is a sort of "header", i.e. HTML before the content. I've used concatenation
// (.= joins strings) so that you can still relate to the html structure, 
// although it could just be represented by:
// echo ("<html><head><title>Example Output</title></head><body>");

// \n is a unix new line
$header "<html>\n";
$header .= "<head>\n";
$header .= "<title>Example Output</title>\n";
$header .= "</head>\n";
$header .= "<body>\n";

$footer "</body>\n";
$footer .= "</html>\n";

echo(
$header);
echo(
"Hello World\n");
echo(
$footer);
?>
That would output:
HTML Code:
<html>
<head>
<title>Example Output</title>
</head>
<body>
Hello World
</body>
</html>
That is pretty much a basic output.
You can then start using condition statements etc to make it do things if certain things are true.
Once you get into it you can start doing all sorts of things.

Here is some PHP I created to do my physics homework for me - it plots a graph (with error bars calculated and drawn on all points, as well as calculating the centroid, then you can manually change the gradient by certain amounts until you get a best fit line) using data input that I got from a Simple Harmonic Motion experiment (uses GD library to draw lines).
It's only PHP 4 (Awardspace at which it is hosted does not support PHP5 unfortunately, so you won't find public or private specified variables, nor have I used magic __construct() or anything above basic OOP.
It gets the job done quite nicely though, and I have commented the code quite a lot.
Example Output

Last edited by andrew247; 01-12-2008 at 12:39 PM.
andrew247 is offline   Reply With Quote
The Following User Says Thank You to andrew247 For This Useful Post:
[ugly_cat] (01-14-2008)