[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
www.dhtmlgoodies.com • View topic - Adding function to Content Organiser script?
Page 4 of 4

PostPosted: Wed Sep 27, 2006 1:10 pm
by divtag32
ah got it working!

cheers Batalf - that works great!

PostPosted: Thu Oct 05, 2006 10:00 am
by divtag32
Hi Batalf,

I hope you can remember the image-switching script I was using - which works great, however I'm struggling as it's just not working with lots of companies that have spaces or alternate names.

What I was hoping you might be able to help me with was altering a bit of the code so I can a) have names of brands with spaces b) have alternate names?

The current thing seems to create an array of images and create the 'keywords' to look out from but yanking off the start and the file extension (please correct me if I'm barking up the wrong tree!).

Is it possible to have an 'or' in such arrays? - ie

if name= "HBOS" or "Halifax Bank of Scotland" then show image...

I don't know if the space is an issue - if I saved my file as Halifax Bank of Scotland.jpg in explorer, it'd add %20 for the spaces I'm guessing - though I could use underscore and convert somehow maybe?!

Does this sound like a massive task or can it be done in Javascript?!



var imgs = new Array()
imgs[0] = "../images/Barclays.jpg";
imgs[1] = "../images/Clydesdale.jpg";
imgs[2] = "../images/HSBC.jpg";
imgs[3] = "../images/NatWest.jpg";
imgs[4] = "../images/Nationwide.jpg";
imgs[5] = "../images/TSB.jpg";
imgs[6] = "../images/HBOS.jpg";
imgs[7] = "../images/Halifax.jpg";
imgs[8] = "../images/RBS.jpg";

var currentlyDisplayedImages = new Array();

function checkText(inputObj)
{
for(var no=0;no<currentlyDisplayedImages.length;no++)currentlyDisplayedImages[no].style.display='none';
currentlyDisplayedImages = new Array();
currentlyDisplayedImages.length = 0;

for(var i = 0; i < imgs.length; i++)
{
if(inputObj)myString = inputObj.innerHTML; else myString = document.getElementById('bankimages').firstChild.nodeValue;
rExp = imgs[i].substring(0,imgs[i].length-4);
results = myString.indexOf(rExp);
if(results != -1)
{
alert('Setting image path ' + imgs[i]);
document.getElementById(rExp+'img').setAttribute('src',imgs[i]);
document.getElementById(rExp+'img').style.display = 'block';
currentlyDisplayedImages[currentlyDisplayedImages.length] = document.getElementById(rExp+'img');
}
}

PostPosted: Thu Oct 05, 2006 10:10 am
by Batalf

PostPosted: Thu Oct 05, 2006 11:08 am
by divtag32

PostPosted: Thu Oct 05, 2006 11:16 am
by Batalf

PostPosted: Thu Oct 05, 2006 12:28 pm
by divtag32

PostPosted: Thu Oct 05, 2006 12:30 pm
by divtag32

PostPosted: Thu Oct 05, 2006 12:33 pm
by divtag32

PostPosted: Thu Oct 05, 2006 12:35 pm
by Batalf

PostPosted: Thu Oct 05, 2006 12:42 pm
by divtag32

PostPosted: Thu Oct 05, 2006 1:02 pm
by Batalf