Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML CSS

PHP and CSS (and XHTML)

Questions and tutorials related to Cascading Style Sheets *all versions*

Moderators: macek, egami, gesf

PHP and CSS (and XHTML)

Postby chewmanfoo » Wed Jan 22, 2003 12:40 am

I can't figure out how to create a web page which is XHTML and links to a CSS stylesheet with PHP. Here's what I tried:

Code: Select all
<?php
?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <link type="text/css" rel="stylesheet" href="style.css">
    <title>
      The Cool Titlel
    </title>
    <meta http-equiv="Refresh"
    content="1; URL=index.php3">
  </head>
  <body>
<?php

// go on with the dynamic content, using styles in style.css and
// echoing strict XHTML syntax


This errors out at the <?xml bit.
I tried it also with all the XHTML header stuff in a $hrd_string using

Code: Select all
$hdr_string = <<<EOQ
.. all the xhtml header stuff
EOQ;


This also errors out.

Please help. How is this supposed to be done? Seems kinda clunky to start every index.php with

Code: Select all
<?php
// notes...
?>
<html>
<head>
...


Does PHP have a better construct for setting up the html page, linking external stylesheets etc?

Thanks in advance,
chewy
chewmanfoo
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Jan 22, 2003 12:30 am
Location: North Texas

Re: PHP and CSS (and XHTML)

Postby WiZARD » Wed Jan 22, 2003 7:43 am

Hi!
All you problem it's PHP configuretions.... try set in php.ini next: short_open_tag = Off
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

What does it do?

Postby chewmanfoo » Wed Jan 22, 2003 7:17 pm

Wizard,

what does the suggestion you gave do?

Where is the problem in the code?

Are you saying this is the proper way to do this?

Thanks!
chewy
chewmanfoo
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Jan 22, 2003 12:30 am
Location: North Texas

Re: What does it do?

Postby WiZARD » Thu Jan 23, 2003 12:39 am

In this part of youre code:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <link type="text/css" rel="stylesheet" href="style.css">
    <title>
      The Cool Titlel
    </title>
    <meta http-equiv="Refresh"
    content="1; URL=index.php3">
  </head>
  <body>
you not have a error, - all work.
Asi said before: you need change PHP.ini
Cause PHP try process this <? like php code but it's not php code :!:
It's simple redirect at index.php3
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to CSS

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.