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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.