Tidy

tina -  
mefistos Messages postés 1 Date d'inscription   Statut Membre -
bonjour a tous

j ai un pb avec tidy

je l ai installe correctement et kan je test avec le code qui suis j ai un message d' erreur qui est le suivant
Fatal error: Cannot instantiate non-existent class: tidy in nonfichier

le code :

<?php
ob_start();
?>
<html>Un document html</html>
<?
$html = ob_get_clean();

// Specify configuration
$config = array(
'indent' => true,
'output-xhtml' => true,
'wrap' => 200);

// Tidy
$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();

// Output
echo $tidy;
?>

merci

1 réponse

  1. mefistos Messages postés 1 Date d'inscription   Statut Membre
     
    Hello/hola:

    if you are using php 5.x.x i dont know whats happening.
    Si estas usando php 5.x.x no se por que falla

    if its 4.3.x then
    Si usas 4.3.x entonces

    first call phpinfo() and look for something like this:
    primero llama phpinfo() y busca algo como:

    tidy
    Tidy support enabled
    libTidy Build Date 12 April 2005

    if it isnt there, mahy be you didnt install tidy properly
    Si no esta, quizas no instalaste bien tidy

    if its there, the problem is that you are using the oo model of php 5.x.x
    Si esta, el problemas es que estas usando el modelo oo de php 5.x.x

    try this, adapted from ar.php.net/tidy -> "User Contributed Notes" :
    Proba esto, adaptado de ar.php.net/tidy -> "User Contributed Notes" :

    ob_start();
    
    /*
    your html
    tu html
    */
    
    $buffer=ob_get_clean();
    $config = array(
               'indent'         => true,
               'output-xhtml'   => true,
               'wrap'           => 200);
    
    // Tidy
    
    tidy_set_encoding('UTF8');
    foreach ($config as $key => $value) {
       tidy_setopt($key,$value);
    }
    
    tidy_parse_string($buffer);
    tidy_clean_repair();
    echo tidy_get_output();
    


    Carlos
    0