For some reason I haven't been receiving any notifications from PHPBuilder (any changes/problems with the site?) so today I found the solution and I came back to post it in case somebody, besides the very kind and available xblue, was following this thread... then I have seen his(/her?) post so an answer to that is due:
Dear Xblue, thanks for your continuous help!
What I meant is that the links are different on every line but I need them to stay the same after the replacement, you know what I mean?
Anyway, you have pointed out one of the two errors I was making: I didn't know I had to use parenthesis... if I had read your post before spending a couple of course trying things blindfolded I would have saved time! ;-)
Anyway, the parenthesis were one thing, the other thing was that I was using the wrong backreferences... I thought I was supposed to use \1 and \2 but now I have found out it works with \2 and \4, which I guess (now that you mention it) is due to the fact that I am using the other parenthesis that you say are useless (which makes me also think that if I removed those then \1 and \2 might have worked, right?)...
Anyway, here is the code that worked for me (remember that vBulleting might do some strange things to it):
$var = preg_replace("#(<tr><td><img src='tline2\.gif' align='absbottom'><img src='open_blue\.gif' align='absmiddle'>)(.*?)(</td></tr>\n<tr><td><img src='open_red_cont\.gif' align='absbottom'>)(.*?)(</td></tr>\n)#im",
"<tr><td><img src='tline2_close.gif' align='absbottom'><img src='open_blue.gif' align='absmiddle'>\\2<br>\n<tr><td><img src='open_red_cont.gif' align='absbottom'>\\4</td></tr>\n",$var);
Now that I have it all worked out let me offer you the results of my second ever PHP script (I am so proud of myself!!) ;-)
I dedicate this script to xblue who helped me so much ;-)
Here it is:
http://www.chaindlk.org/sitemap
Here is what you are looking at:
basically the sitemap you are looking at is created dynamically and on the fly (real time) from the dropdown menu that you see at the top of the page.
The drop down menu is one of the best and most cross-platform I have found. It is called UDM (Ultimate Dropdown Menu) and is done by the fine folks at www.brothercake.com
It is javascripting and DHTML.
In case somebody uses UDM or will be using UDM and wants to use my script I will allow for use.
Basically I process it and create a 2-column site map...
I also added the following features to my script, here is a list, so you too can be proud of me ;-)
- MAIN folders now are in red
- SUB and child folder are in blue
- Non-Linked Descriptive MAIN folders printed out in bold to avoid an entry in the sitemap that is linked to nothing (no dead links such as <a href="">)!!!
- all link's targets ("_top", "blank", "whatever") are retained
- ability to display the sitemap as one column or as two
- real time dynamic creation of the sitemap from the current custom.js file (you never have to manually edit anything in this script, it always mirrors custom.js)
- the entire sitemap is split in half and divided into two columns and the cool thing is that it divides in half respecting the main menus so that you want have part of a main menu on the bottom of the left column and the other half on the top of the right column (this was really hard for me! ;-)
- backward compatible with both UDM 3.7 and 3.8
- optional new color-emphasis feature (just added!!!) - check out my sitemap page to understand... If you click on any of the MAIN menus (either from UDM or from the SiteMap) the SiteMap page will color-emphasize the menu you actually clicked!!! (tricky to achieve, but can be kind of cool for cases like my site where the MAIN menus of UDM all go to the same SiteMap page and you want to actually change that SiteMap page to emphasize where you clicked...
- if somebody has an extra MAIN menu like mine (see where it says "<<-- MAIN MENU (click here)!!!"???) that can be removed also to avoid creating an useless entry in the SiteMap (see it is now mirrored!)
...now to understand the following features take a look at the images I have used (there are 7 of them, and if you download them all to your disk you will see what I am talking about!!!) ha ha
- the first red MAIN folder at the top of every column uses a different image to avoid that it will seem like it is branching out from nowhere!
- the last folder at the bottom of both columns (regardless if it happens to be a red MAIN, a blue SUB or a blue CHILD folder) has a different image to avoid that it will seem like it keeps branching out when nothing actually comes after it!
- every time a SUB menu's instances of CHILD menus are finished the last of the blue CHILD folders has a different image to avoid making it look like it keeps branching out when the SUB menu is really finished - this will be in effect regardless of the fact that the last CHILD folder may precede a new SUB menu or a new MAIN menu (this was another really hard thing to implement... always trying to look ahead of where the script's pointer is and finding out what comes after etc... wow, really hard for me to get that ;-))
Well that is it, I pulled it off, thanks to you at PHPBuilder and to xblue!!
THANK YOU VERY MUCH AGAIN!!!