Reputation: 4560
I tired to find out the solution by googling, but there is only a little information no similar posts.
I installed XAMPP 1.8.3 in OSX and I am trying to install tidy extension for php.
However, from the result of researching, there are only some teaching how to install the extension to OSX but not XAMPP, or maybe I misunderstood the whole thing.....
Yet, I am not familiar with the command line,
can you tell me how can I install the extension to XAMPP (the command line??) or some sites that I can refer to??
Thank you very much!!!
Upvotes: 1
Views: 2971
Reputation: 752
In general: you have two options. Command line tidy (which is easy to install with Homebrew) and the PHP Extension. You can test for both (for example from PHP) like this:
1) Tidy
$command = "tidy -version";
exec($command, $return, $code);
if (count($return) > 0) {
echo "Tidy available!";
}
2) PHP Tidy
if (extension_loaded("tidy")) {
echo "PHP Tidy loaded!";
}
Since the first approach always has worked for me smoothly I never tried the PHP extension.
So you will need the Terminal!
An example (where tidy-in.xml is ugly file and tidy-out.xml the prettified version). Optionally you can provide a config.xml with all kinds of tidy options.
$command = "tidy -indent -utf8 -xml -wrap 1000 tidy-in.xml > tidy-out.xml";
exec($command, $return, $code);
if ($code != 0) {
throw new Exception(printf("Bugger! Something went wrong: %s (%s)", join('<br />', $return), $code));
}
Upvotes: 1