#native_company# #native_desc#
#native_cta#

PHP enabled stylesheets Page 6

By Bertrand Potier
on November 24, 2002

The Index File

As for the visuals.inc file, the first steps are making sure
that the $browser variable passed on to the index.php
are properly retrieved. However this is not the time to discuss this yet.

This whole discussion would have no sense if we were not creating the link
to the stylesheet. It seems that the stylesheet is not interpreted when using
the following code <style type="text/css"
src="stylesheet.css.php">
(your comments are welcomed) so we will
include the stylesheet definitions directly in the index file instead:

<?php

<style type="text/css"><?php require('stylesheet.css.php'); ?></style>

?>


The rest of the code is some pure HTML to test
the styles.

<?php

 
if (substr(phpversion(),0,3) != '4.1') {

  
$_REQUEST array_merge($HTTP_POST_VARS$HTTP_GET_VARS); 

 }

 if ( isset(
$_REQUEST['browser']) ) {

  
$browser $_REQUEST['browser'];

 } else if ( !isset(
$browser) ) {

  
$browser  'ie5';

 }

?>

<html>

 <head>

  <title>Sample Index File</title>

  <style type="text/css"><?php require('stylesheet.css.php'); ?></style>

 </head>

 <body>

  The current browser is <?php print($browser); ?>

  <h1>Heading 1</h1>

  <p>

   Paragraph 1.1

  </p>

  <h2>Heading 2</h2>

  <p>

   Paragraph 2.1

  </p>

  <h3>Heading 3</h3>

  <p>

   Paragraph 3.1

  </p>

  </body>

</html>

?>


1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|