Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch modify HTML (in PHP files) using jQuery-like commands and Linux scripts

I have a collection of old PHP files that need to have their HTML modified to fit to a new design. Tasks include selecting particular elements, removing / adding classes, appending content and manipulating the positions of elements.

In true developer style I'd like to automate it. This is perfectly suited to jQuery or other JS libraries (in fact I've already written the code to act as a temporary hack).

Any suggestions on how to modify a specific file and then save the modified contents?

What do you think about loading jQuery with NodeJS?

like image 744
Arran Schlosberg Avatar asked May 10 '26 00:05

Arran Schlosberg


1 Answers

You seem to be in need of a DOM Selector engine in PHP. Try this http://code.google.com/p/phpquery/, similar to jQuery supports CSS3 also.

like image 74
Troy SK Avatar answered May 12 '26 15:05

Troy SK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!