Jump to content

Parsing around the world


onlyican

Recommended Posts

Hey

This is a mix of php, MySQL, and Javascript

I have downloaded a chat room
They have a function that allowes you to add links to the username in the chat room

The example they give is something like this

[code]
pfcClient.prototype.updateNickList = function(lst)
{
  this.nicklist = lst;
  var nicks  = lst;
  var nickdiv = this.el_online;
  var ul = document.createElement('ul');
  for (var i=0; i<nicks.length; i++)
  {
    var li = document.createElement('li');
    var a = document.createElement('a');



 
    a.setAttribute('href','http://www.google.com/search?q='+nicks[i]);
    a.setAttribute('target','_blank');
    a.setAttribute('class', '<?php echo $prefix; ?>nickmarker <?php echo $prefix; ?>nick_'+ hex_md5(nicks[i]));
    var txt = document.createTextNode(nicks[i]);
    a.appendChild(txt);
    li.appendChild(a);
    ul.appendChild(li);
  }
  var fc = nickdiv.firstChild;
  if (fc)
    nickdiv.replaceChild(ul,fc);
  else
    nickdiv.appendChild(ul,fc);
  this.colorizeNicks(nickdiv);
}
[/code]

This is Javascript a guess

THe array "nicks" is what is holding the usernames,
I dont know Javascript that well
But I am guessing it loops through the usernames, from the for loop
(Dont they have foreach in javascript)

Anyway

What I want to do is grab the username
Run a MySQL query to select the id
Maybe store the results in array called
id_nicks
Then run my link
with id_nicks there, not google

What I dont know how to do is
parse the array nicks into php

then parse the php array back into the javascript

unless I run a query per username
which I dont want to do

Any suggestions, comments ???
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.