The Tournament Director Forums

Main => General Discussion => Topic started by: Magic_fubu on March 28, 2012, 02:56:46 PM

Title: HTML coding question
Post by: Magic_fubu on March 28, 2012, 02:56:46 PM
I know that TD is able to pull information from each tournament file when it exports, and that it is based off the template.  When it comes to coding, I need the hard hat, straight jacket, padded walls, the whole nine yards - I'm not that experienced with it.

How do I make the template, and have it pull information from a CSV file?
Title: Re: HTML coding question
Post by: Corey Cooper on March 28, 2012, 03:00:08 PM
What is it you are trying to accomplish?
Title: Re: HTML coding question
Post by: Magic_fubu on March 28, 2012, 11:59:08 PM
Well, I'm looking to make a table, where I list all the sounds that I use within the program, and have it on my website. That way, if someone wants to request a sound, they can see what I have first. I have the Sound Name, a description, and four or five spots where I may put in an X for where it's used (bust out, round end, game end, hand timer). I have it all in a file, which I will attach, just don't know how to do it.

Ultimately, I want to pull the information from the file, instead of manually typing it in again, if I'm able to.

I attached the CSV file first, and the regular Excel File second, in case that helps any.
Title: Re: HTML coding question
Post by: Corey Cooper on March 29, 2012, 11:25:51 AM
For that you'll need something along the lines of PHP.  Here's some simple PHP code that will read the file and spit it out as an HTML table.  You'll have to save this code to a file on your website with the file extensions "php", and save the CSV file in the same folder.  It's very basic.  You'll have to tailor it to your needs.

Code: [Select]
<html>
  <head>
    <title>Sounds</title>
  </head>
  <body>
  <table>
<?php

if(($handle fopen("TD EVENTS LISTING 3-28-12.csv""r")) !== FALSE)
{
  if((
$row fgetcsv($handle)) !== FALSE)
  {
    print 
"<tr>\n";
    print 
"<th>" join("</th>\n<th>"$row) . "</th>\n";
    print 
"</tr>\n";
  }

  while((
$row fgetcsv($handle)) !== FALSE)
  {
    print 
"<tr>\n<td>" join("</td>\n<td>"$row) . "</td>\n</tr>\n";
  }

  
fclose($handle);
}

?>

    </table>
  </body>
</html>
Title: Re: HTML coding question
Post by: Magic_fubu on March 29, 2012, 11:30:56 AM
Gracias, Merci, Danke, and Thank You!