Icy Phoenix

     
 


Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post Script In Blocks Or Posts 
 
I am currently trying to use my site for a fantasy soccer site, I was using another forum that allowed some php scripting in articles.

This allowed me to take and parse a .csv file and create a roster page (complete with flag images) similar to these

h**p://***.soccermanager.com/screenshots.php

you can click on the roster or table screenshots to get a better idea

I was wondering if there was a way to do the same here.  Basically I save the rosters in Excel (or Open Office) then export them as a .csv file - The script parses the csv file and outputs the tables with the associated graphics

Here is a sample of the code - It would need to be modified but I am posting it in hopes someone may be able to look at it and tell me if doing this is possible in Icy Phoenix

I appreciate the help and time

Code: [Download] [Hide] [Select]
echo '<img src="h**p://all-time-baseball.com/FW/image/728.png" />';

global $settings;

$countries = array (
                    'Brazilian' => 'br',
                    'Spanish' => 'es',
                    'German' => 'de',
                    'Polish' => 'pl',
                    'Czech' => 'cz',
                    'Swiss' => 'ch',
                    'Ivory Coast' => 'ci',
                    'French' => 'fr',
                    'Italian' => 'it',
                    'Portuguese' => 'pt',
                    'Bosnian' => 'ba',
                    'Malian' => 'my',
                    'Netherlands' => 'nl',
                    'Belarusian' => 'by',
                    'English' => 'uk',
                    'Danish' => 'dk',
                    'Croatian' => 'cr',
                    'Togolese' => 'tg',
                    'Argentinean' => 'ar',
                    'Romanian' => 'ru',
                    'Georgian' => 'ge',
                   'Cameroonian' => 'cm',
                   'Mexican' => 'mx',
                   );

$flag_dir = $settings ='Themes/halflife_11final_tp/images/flags/';

$bg[0] = 'windowbg';
$bg[1] = 'windowbg2';
// define path & filename to read
$filename = '../FW/roster/Tottenham.csv';

// read file in as array of line strings
$lines = file($filename);

// explode first line for table header (this also decides number of columns)
$data = explode(",", $lines[0]);
$columns = sizeof($data)-1;

// start table structure
echo'<table cellspacing="1" cellpadding="4" width="100%">';
echo '<tr>';

// put exploded first line in as <th> element
for ($j = 0; $j <= $columns; $j++) {
  $data[$j] = str_replace('"','',$data[$j]);
  echo '<th>' . $data[$j] . '</th>';
}

// end first table row
echo '</tr>';
$win = 0;

// run through remaining lines
for ($i = 1; $i <= sizeof($lines)-1; $i++) {

  // explode line
  $data = explode(",", $lines[$i]);

  // start new row
  echo '<tr class="' . $bg[$win] . '">';
  // put exploded data in as <td> element
  for ($j = 0; $j <= $columns; $j++) {
    $data[$j] = str_replace('"','',$data[$j]);
    if ($j == 2)
      echo '<td><img src="' . $flag_dir . $countries[$data[$j]] . '.png" alt="' . $data[$j] . '" /></td>';
    else
      echo '<td>' . $data[$j] . '</td>';
   }

  // end row
  echo '</tr>';
  $win == 1 ? $win = 0 : $win = 1;
}

// close table tag
echo '</table>';

 



 
tarmerSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: Script In Blocks Or Posts 
 
Hi,
you can do it in several way.

I would suggest to create a block to achieve that instead of insert that code into a post, because you can break the layout.

Creating a block is easy if you know some PHP, try to open any existing block and try to add your code.

A small note: your code is using ECHO to output the code into the page, but it would be better to store the values into a VAR and then assign it to a template VAR like phpBB and Icy Phoenix usually do.

If you need further help do not hesitate to ask.



P.S.: I would like to see the final result!!!
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron