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 Link to comment https://forums.phpfreaks.com/topic/154928-solved-replace-title-with-wz_tooltip-via-a-regex-search/ 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? Link to comment https://forums.phpfreaks.com/topic/154928-solved-replace-title-with-wz_tooltip-via-a-regex-search/#findComment-814969 Share on other sites More sharing options...
MadnessRed Posted April 20, 2009 Author Share Posted April 20, 2009 works perfectly, many thanks Link to comment https://forums.phpfreaks.com/topic/154928-solved-replace-title-with-wz_tooltip-via-a-regex-search/#findComment-814996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.