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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fimble
Forum Newbie
Posts: 12
Joined: Tue Jul 26, 2005 10:13 am

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

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
Last edited by Chris Corbyn on Tue Jul 26, 2005 2:58 pm, edited 1 time in total.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
Fimble
Forum Newbie
Posts: 12
Joined: Tue Jul 26, 2005 10:13 am

Post 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.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

When I first wanted to use CSS on a PHP document I echoed out "<link rel="stylsheet".....";
And ofcourse it worked.
Post Reply