Page 1 of 1

html in php or html that uses php ?(super n00b question)

Posted: Tue Jul 26, 2005 2:52 pm
by Fimble
Ok i as i have mentioned in my other post i have just started out with PHP and i can make a simple html form that can take info in and add it to a mySQL database using php... i can write php that uses html to display the complete database table in an html table.

But how do i actualy go about incorporating that into a good looking web page....

For example my show_student_table.php shows a white background with a simple grid on it containing the data.. if i wanted to use that on my home page would i place the html that makes it look nice within the php or some how pipe the results of the php to an html page for displaying?

I hope it actualy makes sence what im asking?

Posted: Tue Jul 26, 2005 2:56 pm
by Chris Corbyn
Since you're obviously learning from scratch learn CSS. You have a big advantage that you're new to it. CSS is the best way to acheive what you need and some developer's who've been using other methods for a long time sturggle to adapt to it. You wont have that problem.

http://spoono.com in my sig has some tuts. Also http://webmonkey.com and http://w3schools.com/css ;)

No need to learn how to use it with PHP at first, just learn how to make static pages then adapt it for use with PHP ;)

EDIT | I forgot http://alistapart.com/ -> excellent for experts too

Posted: Tue Jul 26, 2005 2:57 pm
by nielsene
Most beginners start out placing <?php ?> blocks within their html so stuff like

Code: Select all

<html>
<head>
<title>Foo</title>
</head>
<body>
Stuff and Junk
<?php 

do some stuff 

?>
Good Bye
</body>
</html>
Is a fine starting point. Eventually most people move to templating systems and/or html generators. Templating systems tend to follow the same system as above, but make it easier to maintain/switch styles,etc. HTML generators work by always being in PHP mode and printing/echoing/building up a string with the whole page. All methods are "valid" and appropriate depending on your project.

Posted: Tue Jul 26, 2005 2:58 pm
by Fimble
Cool, i can do CSS ( in a limited capacity ) with HTML i had no idea i could just apply it to a .php page... if im right in thinking thats what your saying :D
Cheers.

Posted: Wed Jul 27, 2005 12:09 am
by pilau
When I first wanted to use CSS on a PHP document I echoed out "<link rel="stylsheet".....";
And ofcourse it worked.