General_Twyckenham
General_Twyckenham

Reputation: 2261

How to edit a php/html file using PHP

I'm trying to design an interface to change <img> sources throughout my website, so that I don't need to change the sources by hand anytime we want to change what images my site displays.

I looked at DOMDocument already, and while it's useful for accessing the different elements in a file, it wraps the files in it's own HTML tags, which messes up the files (I already tried looking here but those solutions didn't work for me)

Is there a better way to take a file, retrieve element information and attributes (like src and id) from img tags, edit those elements, and save the file?

Upvotes: 2

Views: 2681

Answers (1)

General_Twyckenham
General_Twyckenham

Reputation: 2261

Just to close this up - I ended up using Querypath to accomplish this task. It works pretty well and was pretty simple to utilize.

Upvotes: 1

Related Questions