Your solution needed: Flash VS PHP Java

irishjays - April 9, 2009 - 18:06

Hello Friends,
I have a quick problem: I need to have a scrolling list of supporters in the top left portion of this site for our town mayor. http://www.citizensforakron.com

As far as automatically updating, that isn't needed. What I need is a way to take the results of the web form, CSV Excel export. Add the phone in names to it and have a random name appear every few seconds. There are 1000+ supporters, so I can't have it just scroll from A to Z, because no one would ever wait around to see the latter letters.

I was thinking about using Flash, but would be open to another method.

Anyone done anything like this? I'm pretty sure Drupal can show a random user on each page load, can this method be modified for my needs.

I'm not sure if I fully

marcvangend - April 9, 2009 - 19:07

I'm not sure if I fully understand your question, but personally, I think I would make all supporters available as nodes and then use views to do a random select on every page load. Does that answer your question?

kind of

irishjays - April 9, 2009 - 19:40

But webforms isn't part of CCK, can I use a webform field with Views? If so that would make it easier. I still have to make the names scroll, or animate one by one. I wish I had an example.

Let me try to rephrase:
I have a list of supporters, 90% of that list signs up via webform. The webform output is used in Excel, adn phone in supporters names are added. This leaves me with an excel file of 100% of the names. The client wishes to have the names animated on the top left of the front page. The list is long, so they would like a random name displayed from the list of names every few seconds.

In that case, I would go with

marcvangend - April 9, 2009 - 21:40

In that case, I would go with a custom solution. Import the excel file into a new db table, load the list (or maybe the first 100) in random order and do some php/javascript/jquery magic. If you use php to build the required html, I think there are plenty jquery examples out there to help you with the scrolling or animation.

what your boss want is a

mm167 - April 10, 2009 - 01:46

what your boss want is
a block, on top right, showing 10 supporters' name, and refresh every (say) 1 minute.

to do this
1. u need to save the data in the drupal db as well as in the Excel

2. write a call_back. randomly pick 10 records and return to the caller.

3. a block with jquery and refresh (say) every 1 min.

We go the drupal way. How about you?
http://www.drupalway.com

giving tha a try

irishjays - April 10, 2009 - 13:06

thanks

newb jam

irishjays - April 10, 2009 - 17:52

I've never written a php call before, and I'm getting errors. I have the DB in example: database-Drupal, table-Names, and the two fields first, last. How would I get say 10 random names out? I'm working on cycles now, but that doesn't have much documentation on text blocks inside drupal. I mean, there is a Jquery plug in module that gives you a string for the variable, but where does the CSS for the JQ cycles go? Do I simply define the DIV in that CSS, and paste the PHP call into the DIV?
J

if someone could help with the PHP call that would rock

irishjays - April 10, 2009 - 21:40

I have the jquery down, I just need to get the information out of the DB.

I just need to call a series of 10 random rows (names) from a single table

[db-name]supporters [table]firstlast

I can't seem to grasp the php, involved.

how to get x random records

mm167 - April 11, 2009 - 01:24

how to get x random records from a table

1. the db table should be indexed ..say id ..from 1..N
2. do a select to find the N (select count(*) from table)
3. use php, get a random between 1..N
4. select * from table where id = random no just got
5. goto step 3 for x time u like.

good luck..

PS:
do u need to send MSN message to those supporters?
of course, no junk msn ...
u may setup a msn robot, if a supporter add this msn robot as a msn friend, u may send msn message to this supporter if your mayor has something to say.

We go the drupal way. How about you?
http://www.drupalway.com

here's what I got working

irishjays - April 11, 2009 - 05:29

<?php
$con
= mysql_connect("localhost","supporters","*******");
if (!
$con)
  {
  die(
'Could not connect: ' . mysql_error());
  }

mysql_select_db("supporters", $con);

$result = mysql_query("SELECT * FROM lastfirst ORDER BY Rand() LIMIT 10");

while(
$row = mysql_fetch_array($result))
{
  echo
$row['lastfirst'];
  echo
"<br />";
  }

mysql_close($con);
?>

Gives me 10 random results. Now I just need to put these nicely in jquery. Working on that now.

Step ladder, helpin hand

irishjays - April 11, 2009 - 14:27

Can someone give me a quick tip, I'm not getting jquery through drupal:
I just need a good beginning tutorial on jquery. I can't find any documentation that helps create my solution, if you have seen one please pass i along. I will be happy to write a tutorial on this entire project tomorrow if I can get it settled.

I need the following to happen:
I was going to use cycle, to fade blocks of text in the left sidebar.
I have downloaded the jquery plugins module that includes cycle
I have the scripts generating my 3 random blocks of supporters.

What I think I need.
Where do I call the script?
Do I use the sites style.css to put the cycle styles
Is the a cycles.js in a directory somewhere?

From what I've seen we need to edit the cycles.js type file to tell it what css classes to use for the cycle. How do we do it?
Thanks
J

 
 

Drupal is a registered trademark of Dries Buytaert.