Firm table width in divider sort *PROBLEM SOLVED*

Here you can find plenty of help with your general coding needs and projects
If it is about a specific program, use the corresponding forum
DO NOT ask basic questions such as "How do I print a variable", use Google for that

Firm table width in divider sort *PROBLEM SOLVED*

Postby MirrorFrog » Thu Sep 07, 2006 3:53 pm

ORIGINAL THREAD TITLE "Width in table tradeskill without linebreak"

Hi there... :compress:

First... Thanks for this great Tool. I love it :thumleft:

So, hope you understand my english :mrgreen:

I have a problem to remove the line break from the table Tradeskill if I try to give them a firm width.

I would be pleased if me someone may help me, since I do not find the error.

Maybe the problem i have is very very simple, but im a beginner :neutral: Sorry...

With table for Name & Class etc. it works without problem... :scratch:

Enclosed a screenshot with the problem.


File "memberslist.php" in root folder of the roster.

Code: Select all
/**
 * Controls Output of the Tradeskill Icons Column
 *
 * @param array $row - of character data
 * @return string - Formatted output
 */
function tradeskill_icons ( $row )
{
   global $wowdb, $roster_conf, $wordings;

   $SQL_prof = $wowdb->query( "SELECT * FROM `".ROSTER_SKILLSTABLE."` WHERE `member_id` = '".$row['member_id']."'
AND (`skill_type` = '".$wordings[$row['clientLocale']]['professions']."'
OR `skill_type` = '".$wordings[$row['clientLocale']]['secondary']."')
ORDER BY `skill_order` ASC" );



--->      $cell_value .= '<table border="0" cellpadding="0" cellspacing="0" width="150">';
--->      $cell_value .= '<tr>';


--->   $cell_value .='';
   while ( $r_prof = $wowdb->fetch_assoc( $SQL_prof ) )
   {
      $toolTip = str_replace(':','/',$r_prof['skill_level']);
      $toolTiph = $r_prof['skill_name'];

      $skill_image = 'Interface/Icons/'.$wordings[$row['clientLocale']]['ts_iconArray'][$r_prof['skill_name']];

      $cell_value .= "<img class=\"membersRowimg\" width=\"".$roster_conf['index_iconsize']."\"
height=\"".$roster_conf['index_iconsize']."\" src=\"".$roster_conf['interface_url']
.$skill_image.'.'.$roster_conf['img_suffix']."\" alt=\"\" onmouseover=\"return overlib('$toolTip',
CAPTION,'$toolTiph',RIGHT,WRAP);\" onmouseout=\"return nd();\" />\n";
      
   }

--->      $cell_value .= "</tr>\n</table>\n";

   return $cell_value;

}




What i change

1. Added 2 lines (table for width) before while loop:

Code: Select all
$cell_value .= '<table border="0" cellpadding="0" cellspacing="0" width="150">';
$cell_value .= '<tr>';


2. Added . in "cell_value" bofore while loop:

Code: Select all
$cell_value .='';


3. Added 1 line (table close) after while loop:

Code: Select all
$cell_value .= "</tr>\n</table>\n";
Attachments
linebreak.jpg
Line Break Error
linebreak.jpg (17.38 KiB) Viewed 1079 times
Last edited by MirrorFrog on Fri Sep 08, 2006 3:17 pm, edited 2 times in total.
MirrorFrog
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Mon Jul 17, 2006 4:04 pm

Width in table tradeskill without linebreak

Postby Hannah » Thu Sep 07, 2006 4:24 pm

I don´t know but maybe this peace helps ?

Code: Select all
<td style="white-space:nowrap">
 
User avatar
Hannah
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 142
Joined: Tue Jul 04, 2006 1:41 pm
Location: Germany, Cologne

Re: Width in table tradeskill without linebreak

Postby MirrorFrog » Thu Sep 07, 2006 4:41 pm

First thanks for your fast answer.

Hmmm, i try to replace the empty cell_value, but same result...

Code: Select all
            $cell_value .= '<table border="0" cellpadding="0" cellspacing="0" width="150">';
        
$cell_value .='<tr>';
        
$cell_value .= '<td style="white-space:nowrap">';



    while ( 
$r_prof $wowdb->fetch_assoc$SQL_prof ) )
 


Code: Select all
        $cell_value .= "</td>\n</tr>\n</table>\n";

    return 
$cell_value;
 


Any idea where to put in?
Last edited by MirrorFrog on Thu Sep 07, 2006 4:48 pm, edited 1 time in total.
MirrorFrog
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Mon Jul 17, 2006 4:04 pm

Width in table tradeskill without linebreak

Postby PleegWat » Thu Sep 07, 2006 4:51 pm

I think the best bet would be a width definition in the td of the main table. That'd mean switching in the main body though.

Another alternative would be using COL or COLGROUP elements to define the width for the table cells. You could build a list of COL defines in the loop that constructs the header cells and include it between the opening table tag and the header cells.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Width in table tradeskill without linebreak

Postby MirrorFrog » Thu Sep 07, 2006 8:05 pm

Thank you for your answer PleegWat... ;)

I understand what you mean, but i have no idea how to do that... sorry

i think i know, where the header will be created, but dont know how to change :(

In this part the top corner graphic and top row will be created, right?
And the changes to make a firm width must be there?

Code: Select all
// header row
$tableHeaderRow "  <tr>\n";
$current_col 1;
foreach ( 
$FIELDS as $field => $DATA )
{
    
// See if there is a lang value for the header
    
if( !empty($wordings[$roster_conf['roster_lang']][$DATA['lang_field']]) )
    {
        
$th_text $wordings[$roster_conf['roster_lang']][$DATA['lang_field']];
    }
    else
    {
        
$th_text $DATA['lang_field'];
    }

    
// click a sorted field again to reverse sort it
    // Don't add it if it is detected already
    
if( $_REQUEST['d'] != 'true' )
    {
        
$desc = ( $order_field == $field ) ? '&d=true' '';
    }

    if ( 
$current_col == $cols )
    {
        
$tableHeaderRow .= '    <th class="membersHeaderRight"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    }
    else
    {
        
$tableHeaderRow .= '    <th class="membersHeader"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    }

    
$current_col++;
}
$tableHeaderRow .= "  </tr>\n";
// end header row
 
MirrorFrog
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Mon Jul 17, 2006 4:04 pm

Width in table tradeskill without linebreak

Postby MirrorFrog » Fri Sep 08, 2006 12:17 pm

Okay... Just forget my last post ^^

I found what im looking for.

I Just try to make it work, then i post it for other users who have the same problem and no idea how to realise it.


;)
MirrorFrog
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Mon Jul 17, 2006 4:04 pm

Re: Width in table tradeskill without linebreak

Postby MirrorFrog » Fri Sep 08, 2006 3:08 pm

I solved the problem for all field width. Do the following, so you are able to change all table width. Just play with the array settings for your optimal width... :thumright:

File "memberslist.php" in root folder of roster.

I will try to add the width settings in roster config menu later. :mrgreen:


1. Add a new array above //header row

Code: Select all
// field width in table header
$header_field_width = array(
    
    
"name" => 100,
    
"class" => 105,
    
"members" => 150,
    
"level" => 70,
    
"currenthonor" => 120,
    
"note" => 150,
    
"title" => 80,
    
"zone" => 150,
    
"last_online" => 150,
    
"professions" => 115

    
);
 


2. Search for...

Code: Select all

    
if ( $current_col == $cols )
    {
        
$tableHeaderRow .= '    <th class="membersHeaderRight"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    }

 


...and change with:

Code: Select all
    if ( $current_col == $cols )
    {
        
$tableHeaderRow .= '    <th width="'.$header_field_width[$DATA['lang_field']].'" class="membersHeaderRight"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    }
 



3. Search for...

Code: Select all
    else
    {
        
$tableHeaderRow .= '    <th class="membersHeader"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    } 



...and change with:

Code: Select all
    else
    {
        
$tableHeaderRow .= '    <th width="'.$header_field_width[$DATA['lang_field']].'" class="membersHeader"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    }
 



After all changes it should look like this:

Code: Select all
// field width in table header
$header_field_width = array(
    
    
"name" => 100,
    
"class" => 105,
    
"members" => 150,
    
"level" => 70,
    
"currenthonor" => 120,
    
"note" => 150,
    
"title" => 80,
    
"zone" => 150,
    
"last_online" => 150,
    
"professions" => 115

    
);

// header row
$tableHeaderRow "  <tr>\n";
$current_col 1;
foreach ( 
$FIELDS as $field => $DATA )
{
    
// See if there is a lang value for the header
    
if( !empty($wordings[$roster_conf['roster_lang']][$DATA['lang_field']]) )
    {
        
$th_text $wordings[$roster_conf['roster_lang']][$DATA['lang_field']];
    }
    else
    {
        
$th_text $DATA['lang_field'];
    }

    
// click a sorted field again to reverse sort it
    // Don't add it if it is detected already
    
if( $_REQUEST['d'] != 'true' )
    {
        
$desc = ( $order_field == $field ) ? '&d=true' '';
    }

    if ( 
$current_col == $cols )
    {
        
$tableHeaderRow .= '    <th width="'.$header_field_width[$DATA['lang_field']].'" class="membersHeaderRight"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";


    }
    else
    {
        
$tableHeaderRow .= '    <th width="'.$header_field_width[$DATA['lang_field']].'" class="membersHeader"><a href="?s='.$field.$desc.'">'.$th_text."</a></th>\n";
    }

    
$current_col++;
}
$tableHeaderRow .= "  </tr>\n";
// end header row
 
Last edited by MirrorFrog on Fri Sep 08, 2006 3:55 pm, edited 2 times in total.
MirrorFrog
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Mon Jul 17, 2006 4:04 pm

Firm table width in divider sort *PROBLEM SOLVED*

Postby Veliane » Fri Dec 15, 2006 7:03 am

working great for me :)
Veliane
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Wed Dec 13, 2006 10:20 am


Return to General Code Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron