You are here:  » How to use a css style


How to use a css style

Submitted by umbro909 on Wed, 2007-03-21 16:40 in

Hi David,

me again :-)

Can you tell me how can I customize my xml data with a css stylesheet?
Because I'm trying but.. :-(

here's my code:

<?php
  header
("Content-Type: text/html;charset=utf-8");
  <
link href="css/ice.css" rel="stylesheet" type="text/css">
  require(
"MagicParser.php");
  function 
myProductRecordHandler($record)
  {
    print 
"<div class='icedesc'> ";
    print 
"<img src='".$record["PRODUCT-LOWPIC"]."' />";
    print 
"<p>".$record["PRODUCT/PRODUCTDESCRIPTION-LONGDESC"]."</p>";
    print 
"</div>";
  }
  
// first parse to extract the top level product information
  
$url "http://localhost/xml/457799.xml";
  
MagicParser_parse($url,"myProductRecordHandler","xml|ICECAT-INTERFACE/");
  print 
"<h3>Features</h3>";
  function 
myFeatureRecordHandler($record)
  {
    print 
"<p>";
    print 
$record["FEATURE/NAME-VALUE"].": ";
    print 
$record["PRODUCTFEATURE-VALUE"]." ";
    print 
$record["FEATURE/MEASURE-SIGN"];
    print 
"</p>";
  }
  
// second parse to extract the feature list
  
MagicParser_parse($url,"myFeatureRecordHandler","xml|ICECAT-INTERFACE/PRODUCT/PRODUCTFEATURE/");
?>

Submitted by support on Wed, 2007-03-21 16:42

Hi,

You need to print the CSS line rather than include it in your script directly, for example:

<?php
  
print '<link href="css/ice.css" rel="stylesheet" type="text/css">';
?>

Hope this helps!
Cheers,
David.