• 10
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

How can I validate CSS within a script? [closed]

W3C has an API:

http://jigsaw.w3.org/css-validator/api.html

You can also download the validator and run it locally: http://jigsaw.w3.org/css-validator/DOWNLOAD.html

You need to be able to run java from your script.

  • 10
Reply Report
    • It is a good idea to download the validator and run it locally if you are going to hit it a lot though. You'll get better performance and you won't be eating up the service's bandwidth.
      • 1
    • Thanks! That's the canonical source, I guess. I do run this several times a day during development, so their Java program is ideal.

There is a pear package called Services_W3C_CSSValidator which does this. You can download the PHP class directly from the github if you prefer.

Its very simple to use.

require_once 'Services/W3C/CSSValidator.php';
$v = new Services_W3C_CSSValidator();
$result = $v->validateFile('pear_manual.css'); // XML

It includes all features available at http://jigsaw.w3.org/css-validator

  • 2
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions