Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 05-23-2015, 04:51 PM
pityocamptes's Avatar
pityocamptes pityocamptes is offline
 
Join Date: Apr 2010
Posts: 595
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oK. Here is what I have so far to test on my site. I need the widget content to be 236px by 110px... for some reason it is not working... I am getting massive overflow on the side box. Anyone??? Thanks.

Code:
ob_start();

$input = 'https://www.fdic.gov/bank/individual/failed/banklist.csv';



echo "<style>
tr.row:nth-child(odd) {
    background: blue;
}

tr.row:nth-child(even) {
    background: black;
}
table.tBorder{
	width:236; /* or what you need it to be */
	height: auto; /* make this the size you want the data to be displayed in */
	overflow: auto; /* this adds the scroll bars to the div when any data exceeds its hieght */

}
td.border{
    width: 50%;
    border-top: 1px solid #000000; 
    border-bottom: 0px solid #000000; /* move spacing to the cell */

}



</style>";

echo '<table class=tBorder >';

if (false !== ($ih = fopen($input, 'r'))) 
{
fgetcsv($ih);
    while (false !== ($data = fgetcsv($ih))) 
    {    
        $outputData = array($data[0], $data[1], $data[4], $data[5]); 
		
		echo "<tr class=row >";
		
		foreach ($outputData as $row)
		{
			echo "<td class=border align=center ><FONT COLOR=D3AB04 FACE=Geneva, Arial SIZE=2>" . htmlspecialchars($row) . "</FONT></td>";
		
		
        	}	
		
    }


}

fclose($ih);
echo '</table>';
$html = ob_get_clean();
return $html;
--------------- Added [DATE]1432407996[/DATE] at [TIME]1432407996[/TIME] ---------------

I found this code, but have no idea how to incorporate it into the code above... HELP...

Quote:
<div id="table_wrapper">
<div id="tbody">
<table>
<tr>
<td class="td1">1</td><td class="td2">2</td><td class="td3">3</td>
</tr>
... more rows here
</table>
</div>
</div>

#table_wrapper{background:tomato;border:1px solid olive;float:left;}
#tbody{height:80px;overflow-y:auto;width:400px;background:yellow;}
table{border-collapse:collapse; width:100%;}
td{padding:1px 5px; /* pixels */
border-right:1px solid red; /* to avoid the hacks for the padding */
border-bottom:1px solid red;}
.td1{width:100px;}
.td2{width:140px;}
.td3{border-right-width:0;} /* optional */

<div id="table_wrapper">
<div id="header">
<div id="head1">Left</div>
<div id="head2">Center</div>
<div id="head3">Right Column</div>
</div>
<div id="tbody">
<table>
<tr>
<td class="td1">1</td><td class="td2">2</td><td class="td3">3</td>
</tr>
... more rows here
</table>
</div>
</div>

#header{width:400px;backgroundodgerBlue;border-bottom:1px solid red;}
#header div{padding:1px 5px;float:left;border-right:1px solid orange;}
#header #head1{width:100px;} /* the same as td1 */
#header #head2{width:140px;} /* the same as td2 */
#header #head3{float:none;border-right-width:0}
Note: padding-left/right and width of the header columns.
The width of the #thead and #tbody is same.
--------------- Added [DATE]1432412880[/DATE] at [TIME]1432412880[/TIME] ---------------

Getting a little closer, not sure what is going on here... thanks.

Code:
ob_start();

$input = 'https://www.fdic.gov/bank/individual/failed/banklist.csv';



echo "<style>

.parentTbl table {
  border-spacing: 0;
  border-collapse: collapse;
  border: 0;
  width: 236px;
}
.childTbl table {
  border-spacing: 0;
  border-collapse: collapse;
  border: 1px solid #d7d7d7;
  width: 236px;
}
.childTbl th,
.childTbl td {
  border: 1px solid #d7d7d7;
}
.scrollData {
  width: 236;
  height: 110px;
  overflow-x: hidden;
}

tr.row:nth-child(odd) {
    background: blue;
}

tr.row:nth-child(even) {
    background: black;
}
/* table.tBorder{
	width:250; /* or what you need it to be */
	height: auto; /* make this the size you want the data to be displayed in */
	overflow: auto; /* this adds the scroll bars to the div when any data exceeds its hieght */

}
td.border{
    width: 50%;
    border-top: 1px solid #000000; 
    border-bottom: 0px solid #000000; /* move spacing to the cell */

}
*/
</style>";

echo '<div class=parentTbl>';
 echo '<table>';
  echo '<tr>';
   echo '<td>';
    echo '<div class=childTbl>';
     echo '<table class=childTbl>';
      echo '<tr>';
       echo "<th>Bank Name</th>";
       echo "<th>City</th>";
       echo "<th>Acq. Institution</th>";
       echo "<th>Closing Date</th>";
     echo '</tr>';
    echo '</table>';
   echo '</div>';
  echo '</td>';
 echo '</tr>';
 
 echo '<tr>';
 echo '<td>';

if (false !== ($ih = fopen($input, 'r'))) 
{
fgetcsv($ih);
    while (false !== ($data = fgetcsv($ih))) 
    {    
        $outputData = array($data[0], $data[1], $data[4], $data[5]); 
        
        	echo '<div class=scrollData childTbl>';
        	 echo '<table>';		
		  echo '<tr class=row >';
		
		foreach ($outputData as $row)
		{
			echo "<td class=border align=center ><FONT COLOR=D3AB04 FACE=Geneva, Arial SIZE=2>" . htmlspecialchars($row) . "</FONT></td>";
		
		
        	}	
        	
        	  echo '</tr>';
        	  echo '</table>';
        	  echo '</div>';
        	
        			
    }


}

fclose($ih);

echo '</td>';
echo '</tr>';
echo '</table>';
echo '</div>';
$html = ob_get_clean();
return $html;
--------------- Added [DATE]1432435559[/DATE] at [TIME]1432435559[/TIME] ---------------

Ok, finally got the code to how I want it. How do I get a javascript and the php code to run in the widget box??? Thanks.

Code:
<?php 


$input = 'https://www.fdic.gov/bank/individual/failed/banklist.csv';



echo "<style>

.parentTbl table {
  border-spacing: 0;
  border-collapse: collapse;
  border: 0;
  width: 220px;
  table-layout: fixed
}
.childTbl table {
  border-spacing: 0;
  border-collapse: collapse;
  border: none; /* 1px solid #d7d7d7; */
  width: 219px;
  table-layout: fixed
}
.childTbl th,
.childTbl td {  
  font-size: 12px;
  font-weight:bold;
  background: #222937;
  color: white;  
  width: 10px;
  border-bottom: 1pt solid red;
  cursor: pointer;
}

.scrollData {
  width: 236px;
  height: 110px;
  overflow-x: hidden;
}

td.border{
  color: #D3AB04;
  font-size: 11px;
  width: 10px;
}

tr.row:nth-child(odd) {
    background: #222937;
}

tr.row:nth-child(even) {
    background: black;
}

</style>";

echo '<div class=parentTbl>';
 echo '<table>';
  echo '<tr>';
   echo '<td>';
    echo '<div class=childTbl>';
     echo '<table class=childTbl>';
     echo '<thead>';
      echo '<tr>';
		echo '<th onclick="sort_table(people, 0, asc1); asc1 *= -1; asc2 = 1; asc3 = 1; asc4 = 1;">Bank Name</th>';
        echo '<th onclick="sort_table(people, 1, asc2); asc2 *= -1; asc3 = 1; asc4 = 1; asc1 = 1;">City</th>';
        echo '<th onclick="sort_table(people, 2, asc3); asc3 *= -1; asc4 = 1; asc1 = 1; asc2 = 1;">Acq. Inst.</th>';
		echo '<th onclick="sort_table(people, 3, asc4); asc4 *= -1; asc1 = 1; asc2 = 1; asc3 = 1;">Closing Date</th>';
     echo '</tr>';
     echo '</thead>';
    echo '</table>';
   echo '</div>';
  echo '</td>';
 echo '</tr>';

echo '<tr>';
 echo '<td>';
  echo '<div class=scrollData childTbl>';
   echo '<table>';	    
	echo '<tbody id=people>';

if (false !== ($ih = fopen($input, 'r'))) 
{
fgetcsv($ih);
    while (false !== ($data = fgetcsv($ih))) 
    {    
        $outputData = array($data[0], $data[1], $data[4], $data[5]); 
        
              
		      echo '<tr class=row>';
		
		      	foreach ($outputData as $row)
		      	{
					echo "<td class=border>" . htmlspecialchars($row) . "</td>";		
		
        	  	}	
        	
        	  echo '</tr>';       	
        			
    }

}
   echo '</tbody>';
   echo '</table>';
  echo '</div>'; 

fclose($ih);

echo '</td>';
echo '</tr>';
echo '</table>';
echo '</div>';


?>

<script type="text/javascript">
        var people, asc1 = 1,
            asc2 = 1,
            asc3 = 1;
		    asc4=1;
        window.onload = function () {
            people = document.getElementById("people");
        }

function sort_table(tbody, col, asc){
    var rows = tbody.rows, rlen = rows.length, arr = new Array(), i, j, cells, clen;
    // fill the array with values from the table
    for(i = 0; i < rlen; i++){
    cells = rows[i].cells;
    clen = cells.length;
    arr[i] = new Array();
        for(j = 0; j < clen; j++){
        arr[i][j] = cells[j].innerHTML;
        }
    }
    // sort the array by the specified column number (col) and order (asc)
    arr.sort(function(a, b){
        return (a[col] == b[col]) ? 0 : ((a[col] > b[col]) ? asc : -1*asc);
    });
    for(i = 0; i < rlen; i++){
        arr[i] = "<td class=border>"+arr[i].join("</td><td class=border>")+"</td>";
    }
    tbody.innerHTML = "<tr class=row>"+arr.join("</tr><tr class=row>")+"</tr>";
}
    </script>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:32 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05000 seconds
  • Memory Usage 2,216KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete