MadnessRed Posted April 20, 2009 Share Posted April 20, 2009 Hi, what I would like is a way to search through a template and wherever I come across title="*" replace with onmouseover="Tip('*');" onmouseout="UnTip();" What would be really great if someone could explain the code as well as I am having trouble with regex. I would also like to knwo how much this would slow down page generation if this was beign used to find/replace a whole page. Many thanks Quote Link to comment Share on other sites More sharing options...
nrg_alpha Posted April 20, 2009 Share Posted April 20, 2009 First try this on a copy of the template file in question (just in case): $file = 'path/to/template/and/filename'; //replace this with actual template path and file name in question $modify = preg_replace('#title="([^"]+)"#', 'onmouseover="Tip(\'\\1\');" onmouseout="UnTip();"', file_get_contents($file)); file_put_contents($file, $modify); Would this be along the lines of what you are looking for? Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted April 20, 2009 Author Share Posted April 20, 2009 works perfectly, many thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.