Forum Moderators: coopster
I finished with the layout of my pages using css. The idea is that after loggin into the system, you will see this page: <snip>
The question I now run into is how to use css with php? I've red some things in this forum that it will work, but it's not all clear to me how exacly. For example the use of include or just <link rel="StyleSheet" type="text/css" href="beststyl.css"/>. And is it possible to just write php code between the css divs? Will css interpret this as 'normal' xhtml. For example my input fields have some layout properties (like borderstyle, font-size, etc). will this work if I 'echo' this in php? (Because these get a value from a xml file)
I hope that my question is clear enough.....
Regards,
Jacco
[edited by: jatar_k at 7:38 pm (utc) on Mar. 5, 2004]
[edit reason] no personal urls thanks [/edit]
;)
When yo write a page in php, perl and this kind of languages, you use some commands to "write" the html page in the browser once all the information is together, i mean, tags, information from databases, etc, so in the same way yo write some code like this (just an example)
write("<html>")
write("<head>")
write("<title>Losadres selecteren</title>")
...
you can write another line like this one:
write("<link rel='stylesheet' href='your_style.css' type='text/css' />")
There is no problem about write code beteween the div tags, but you have to be careful with the comiles, values, names, tags and all the things of a normal xhtml page.
You talk about an xml file... what gets the value from it? the input files? If the answer is yes, there is no problem about
Hope it helps, but i think you are in the right way by your own
:)
So it basically means that I have to put 'echo' in front of each line in my (old) html file? So this implies that no real html will be left in my php file... Everything will be managed by the php server... Sounds fine to me, but I wonder why it is possible to write php and html in one file. (Just a general thought) :)
And yes, I'm planning to write php code that will parse data from xml and put it in the responsible input fields...
Regards,
Jacco
No, you dont.
Here is my head.inc file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<head>
<title>McDonough Fine Arts - Welcome</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" >
<META name="KEYWORDS" Content="fine art, mcdonough, mcdonough fine art, art prints, art maps, antique prints, antique maps" >
<META name="description" content="McDonough Fine Art, dealers in antiquarian prints, books, and maps" >
<META name="KEYWORDS" content="audubon prints, ornithological art, gould prints, old maps, fine art prints, native american prints, kinney hall prints">
<META name="robots" content="NOARCHIVE">
<META name="robots" content="INDEX,FOLLOW"><link rel="stylesheet" type="text/css" href="css/menus.css" >
<script language="javascript" src="popwin.js" type="text/javascript">
</script>
</head>
This is placed in every page by:
require 'head.inc';
within the PHP, like so in my index.php file:
<?php
require 'head.inc';
if (isset($_GET['class'])) {
$class="";
}
include 'containers.inc';
if (!isset($_GET['page'])) {$content= 'page1.inc';}
else {$content= $_GET['page'];}include $content;
include 'footer.inc';
?>
Does that help?
Thanks. Learning step by step here :) Perhaps that will help, but I'm missing the big picture here. How does your <body> look like in this case for example?
In html my pages are in general build like this:
<body>
<div header>
<div content>
<some smaller divs>
<div footer>
How should I translate/merge this to php?
Regards,
Jacco
<html>
<head>
<title>Sample PHP Document</title>
<link rel="StyleSheet" type="text/css" href="beststyl.css"/>
</head>
<body>
<?php
# the above tag starts processing PHP commands
# doing some php stuff here
echo "<p>Hello World!</p>\n";
# the tag below ends the processing
# of PHP commands
?>
</body>
</html>
It really doesn't matter how you apply CSS in relation to PHP. All PHP processing happens before the web page comes to the browser, and it's the browser that handles the CSS code... so as long as your PHP code is syntax-error free, then the CSS should work if it is linked, embedded, or in-line.
regards,
Jacco
<?=$varname?>
Use the <? and?> to open close php(as im sure you know)
= also is a way to 'echo' the variable
and then the variable name
you can also do this with an array stored in row by:
<?= Row['varname']?>
An example of an input field would be
<input name="DateLocked" maxlength=255 size=21 type="text" value="<?=$DateLocked?>">
Href:
<a href="blah_blah.php?BlahID=<?=$BlahID?>&BlehID=<?=$BlehID?>">
Etc Etc
Hope this helped :)