Markus: onload Event beim lader einer tabelle?

Beitrag lesen

Hy,

Ich sag ja, etwas kompliziert: Generell PHP-Script mit HTML-Ausgabe! Shop mit vielen Erweiterungen OSCOMMERCE. Die index.php wird gestartet und gibt eine default Seite im HTML aus. Klicke ich nun auf eine kategorie wird über die index.php eine product-listing aufgerufen, diese ruft wiederrum eine php funktion, welche die HTML Tabelle ausgibt, und aus der Index.php die funktion aufruft.

Doch etwas kompliziert.

Bsp - Index.php:   } else { // default page ?>     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">       <tr>         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">           <tr>             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>             <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING _TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>         </table></td>       </tr>       <tr>         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>       </tr>       <tr>         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">           <tr>             <td class="main"><?php echo tep_customer_greeting(); ?></td>           </tr>           <tr>             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>           </tr>           <tr>             <td class="main"><?php echo TEXT_MAIN; ?></td>           </tr>           <tr>             <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>           </tr>

<td><?php //include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>           </tr>

<tr> <!-- Angebote auf Startseite, wenn Bild verfuegbar ist -->                 <td><?php //include ( DIR_WS_MODULES . FILENAME_NEW_PRODUCTS );                     $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id,p .products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE _SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.lang uage_id = '" . (int)$languages_id . "' and s.status = '1' and p.products_image !='' order by s.specials_date_added DESC";                     $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);                     if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION = = '3'))) {                     ?>

Bsp Product-Listing.php       case 'PRODUCT_LIST_NAME': //        $lc_align = ''; //        if (isset($HTTP_GET_VARS['manufacturers_id'])) { //          $lc_text = '<a target="unten" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS[ 'manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . substr($listing['products_description'],0,28) . '</a

';

//        } else { //          $lc_text = '&nbsp;<a target="unten" href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . ' &' : '') . 'products_id=' . $listing['products_id']) . '">' . substr($listing['products_description'],0,28) .   '</a>...&nbsp; '; //        } //        break;           $lc_align = '';           if (isset($HTTP_GET_VARS['manufacturers_id'])) { //              $lc_text = '&nbsp;<a target="unten" href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath  . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . substr($listing['products_description'],0,28) .   '</a>...&n bsp;';

$lc_text = '<a style="cursor:default;"><font face="Arial" size="-2"><BIG><b>' . $listing['products_name'] . '</b

</BIG></a><br></font>';

$lc_text .= '<a style="cursor:default;"><font face="Arial" size="-3">' . $listing['products_description'] . '</a

</font>';

$href2[] .= tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $lis ting['products_id']) ;             } else {               $lc_text = '<a style="cursor:default;"><font face="Arial" size="-2"><BIG><b>' . $listing['products_name'] .   '< /b></BIG></font></a><br>';               $lc_text .= '<a style="cursor:default;"><font face="Arial" size="-3">' . $listing['products_description'] .   '< /font></a>';               $href2[] .= tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $lis ting['products_id']) ;               }         break;

. . .     new productListingBox3($list_box_contents,$href2,$href3);

} else {     $list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');     $list_box_contents[0][] = array('params' => 'class="productListing-data"',                                    'text' => TEXT_NO_PRODUCTS);

new productListingBox3($list_box_contents,$href2,$href3);   }

Bsp - boxex.php   class tableBox3 {     var $table_border3 = '0';     var $table_width3 = '100%';     var $table_cellspacing3 = '0';     var $table_cellpadding3 = '2';     var $table_parameters3 = '';     var $table_row_parameters3 = '';     var $table_data_parameters3 = '';     var $table_string3 = '';    //edit - noJS coolmenu     var $s = 0;

// class constructor     function tableBox3($contents, $direct_output = false, $href2, $href3) {       $tableBox_string = '<table border="' . tep_output_string($this->table_border3) . '" width="' . tep_output_string($this-> table_width3) . '" cellspacing="' . tep_output_string($this->table_cellspacing3) . '" cellpadding="' . tep_output_string($this ->table_cellpadding3) . '"';       if (tep_not_null($this->table_parameters3)) $tableBox_string .= ' ' . $this->table_parameters3;       $tableBox_string .= ' onload="javascript:pOpen('' . addslashes($href3) . '')">' . "\n";

for ($i=0, $n=sizeof($contents); $i<$n; $i++) {         if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . " \n";         $s= $s + 1;

//        $tableBox_string .= '  <tr class="out" target="unten" id="' . $s . '" onclick="setStyle(this,id)" onmouseover={this. style.backgroundColor="#dfdf99"} onmouseout={this.style.backgroundColor="#f8f8f9"} ';         $tableBox_string .= '  <tr target="unten" id="' . $s . '" onclick="setStyle(this,id,'' . addslashes($href2[$s]) . '' )" '; //        $tableBox_string .= '  <tr id="' . $s . '" ';         if (tep_not_null($this->table_row_parameters3)) $tableBox_string .= ' ' . $this->table_row_parameters3;         if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i][' params'];         $tableBox_string .= ' >' . "\n";

if (isset($contents[$i][0]) && is_array($contents[$i][0])) {           for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {             if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) { //              $tableBox_string .= '    <td onclick="pOpen('' . addslashes($href2[$s]) . '')"';               $tableBox_string .= '    <td';

if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align=" ' . tep_output_string($contents[$i][$x]['align']) . '"';               if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {                 $tableBox_string .= ' ' . $contents[$i][$x]['params'];               } elseif (tep_not_null($this->table_data_parameters)) {                 $tableBox_string .= ' ' . $this->table_data_parameters;               } /*            if ($x == "2"){               $tableBox_string .= ' width="33%" >';               }elseif ($x=="0"){               $tableBox_string .= ' width="25%" >';               }elseif ($x=="1"){               $tableBox_string .= ' width="31%" >';               }elseif ($x=="3"){               $tableBox_string .= ' width="8%" >';               }               elseif ($x=="4"){               $tableBox_string .= ' width="3%" >';               } */               $tableBox_string .= ' >';

if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$ i][$x]['form'];               $tableBox_string .= $contents[$i][$x]['text'];               if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';               $tableBox_string .= '</td>' . "\n";             }           }         } else {           $tableBox_string .= '    <td';           if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_outp ut_string($contents[$i]['align']) . '"';           if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {             $tableBox_string .= ' ' . $contents[$i]['params'];           } elseif (tep_not_null($this->table_data_parameters)) {             $tableBox_string .= ' ' . $this->table_data_parameters;           }           $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";         }

$tableBox_string .= '  </tr>' . "\n";         if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";       }

$tableBox_string .= '</table>' . "\n";

if ($direct_output == true) echo $tableBox_string;           $this->table_string3 = $tableBox_string;      //edit - noJS coolmenu

return $tableBox_string;     }   } . . .    class productListingBox3 extends tableBox3 {     function productListingBox3($contents,$href2,$href3) {       $this->table_parameters3 = 'class="productListing" id="plistings"';       $this->tableBox3($contents, true,$href2,$href3);     }

Etwas komplex!, Oder!