Jump to content

keeB

Staff Alumni
  • Posts

    1,075
  • Joined

  • Last visited

About keeB

  • Birthday 08/29/1985

Contact Methods

  • AIM
    nickstinemates
  • MSN
    nickistotally@live.com
  • Website URL
    http://nick.stinemates.org/wordpress/
  • Yahoo
    nickstinemates@yahoo.com

Profile Information

  • Gender
    Male
  • Location
    California

keeB's Achievements

Member

Member (2/5)

0

Reputation

  1. Here's what I came up with Given nick@avari ~/code/php $ ls -l -R .: total 12 drwxr-xr-x 2 nick nick 4096 Jul 13 13:27 audio drwxr-xr-x 2 nick nick 4096 Jul 13 13:27 images -rw-r--r-- 1 nick nick 1166 Jul 13 14:02 test.php ./audio: total 0 -rw-r--r-- 1 nick nick 0 Jul 13 13:27 lol.mp3 ./images: total 0 -rw-r--r-- 1 nick nick 0 Jul 13 13:27 lol.png Output: <a class='myPlayer' href='audio/lol.mp3' style='background-image:url(images/lol.png)'> </a> And... here's the code <?php function directory_to_array($dir) { $ret = array(); $dh = opendir($dir); while (($file=readdir($dh)) !== false) { if ($file != "." && $file != "..") // ignore . and .. $ret[] = $file; } closedir($dh); return $ret; } function match_files($audio, $image) { //assume basename in $audio and $image are the same //merges the two to a new array $ret = array(); foreach ($audio as $name) { $abase = explode(".", $name); foreach ($image as $img) { $ibase = explode(".", $img); if ($abase[0] == $ibase[0]) { $ret[] = array($name, $img); } } } return $ret; } function merge_to_player($input) { foreach ($input as $pair) { print "<a class='myPlayer' href='audio/$pair[0]' style='background-image:url(images/$pair[1])'> </a> "; } } //get the audio directory contents $audio = directory_to_array("audio"); //get the image directory contents $image = directory_to_array("images"); $matched = match_files($audio, $image); merge_to_player($matched); ?>
  2. The addition you'd need to make to your code, then, is to read the images directory in the same fashion as you are the audio directory The other piece of this, which I assume is what you're having trouble with, is understanding how to merge the two items in your array and display them. Take a look at building an array that would look like Array ( [0] => Array ( [0] => song1.mp3 [1] => image1.png ) . . . ) Do you know how to do that?
  3. || means OR. You'd use it like so: <?php if ($my_mom == "ghetto" || $my_mom == "white trash")) { // if my mom is ghetto or white trash... $i = "cannot spell which is why I say 'wat'"; } ?>
  4. Can you post a DDL of your database and the query you are currently using to generate results of your search?
  5. How familiar are you with SQL joins?
  6. Tell. Don't ask.
  7. http://tryit.adobe.com/us/cs4/dreamweaver/tw1/?sdid=ETRPJ Adobe Dreamweaver is the canonical paid choice for an 'all in one' You can achieve the same level of success with Free (Open Source) tools such as Eclipse PDT with embedded browser. I'm of the opinion that each tool should be designed for a particular job and do it extremely well. As such, I shy away from "ALl in one" tools. The tradeoff is to be most productive I require a lot of screen real estate and virtual desktops (provided by linux)
  8. That might be the coolest name ever. Qadoshyah. Your form is returning 2 results and isn't very user friendly. Functionality wise it's not very pleasing to use. Being able to search by some other keywords would be nice. When you say you want to incorporate all of the data in to the search, are you taking about the results or the input parameters?
  9. There wouldn't be one canonical person who does the grading for a course?
  10. Instead of classes_to_students I'd store the data in the ReportCard table. This way you have a summary all in one table without an intermediary. The classes_to_students recommended by roopert seems a bit over the top for this case. <?php class ReportCard { private $student; //fk to student private $instructor; // fk to instructor private $course; // fk to classes private $grade; // A, B, C, D, F } ?>
  11. I am working on a project which requires analysis and generation of a Cartesian Product for a list of Products which go together. Ideally, you'd be able to group the list of Product's by price range (low, mid, high.) Given this task, how would you accomplish it? I'll be happy to share snippets of my results as the post matures.
  12. I suppose you should use http://php.net/include Makes sense doesn't it?
  13. Invisible iframes ftw
  14. Slimmer != better. This guy is writing in dreamweaver. That tells you he's not ready for short hand if statements.
  15. No, I mean -- I now know the username and password to your database. This is not a good thing.
×
×
  • 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.