Jump to content

[SOLVED] replace title with wz_tooltip via a regex search


MadnessRed

Recommended Posts

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.