[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?
Advertisement

Adding function to Content Organiser script?

Moderators: Calcifer, slothy

Postby divtag32 » Wed Sep 27, 2006 1:10 pm

ah got it working!

cheers Batalf - that works great!
divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby divtag32 » Thu Oct 05, 2006 10:00 am

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');
}
}
divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby Batalf » Thu Oct 05, 2006 10:10 am

Batalf
Site Admin
 
Posts: 2160
Joined: Sat Oct 22, 2005 9:38 pm

Postby divtag32 » Thu Oct 05, 2006 11:08 am

divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby Batalf » Thu Oct 05, 2006 11:16 am

Batalf
Site Admin
 
Posts: 2160
Joined: Sat Oct 22, 2005 9:38 pm

Postby divtag32 » Thu Oct 05, 2006 12:28 pm

divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby divtag32 » Thu Oct 05, 2006 12:30 pm

divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby divtag32 » Thu Oct 05, 2006 12:33 pm

divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby Batalf » Thu Oct 05, 2006 12:35 pm

Batalf
Site Admin
 
Posts: 2160
Joined: Sat Oct 22, 2005 9:38 pm

Postby divtag32 » Thu Oct 05, 2006 12:42 pm

divtag32
 
Posts: 50
Joined: Mon Sep 25, 2006 12:54 pm

Postby Batalf » Thu Oct 05, 2006 1:02 pm

Batalf
Site Admin
 
Posts: 2160
Joined: Sat Oct 22, 2005 9:38 pm

Previous

Return to General questions regarding AJAX scripts

Who is online

Users browsing this forum: No registered users and 7 guests

cron