bubu Posted August 27, 2004 Report Posted August 27, 2004 Tabula pati aiztaisīsies tad, kad tu gribēsi viņu izvadīt, t.b. ->getHtml() izsaukumā.
рпр Posted August 27, 2004 Report Posted August 27, 2004 tagad saproti? <?php $table = new table('caption'); $table->addRow('aa', 'bb', 'cc'); $table->addRow('aa'...); $table->display(); ?>
Sliipeetais Posted August 27, 2004 Author Report Posted August 27, 2004 Un ko tieši šajā gadījumā paveic getHtml() funkcija?
Sliipeetais Posted August 27, 2004 Author Report Posted August 27, 2004 tagad saproti? <?php $table = new table('caption'); $table->addRow('aa', 'bb', 'cc'); $table->addRow('aa'...); $table->display(); ?> Tādā gadījumā, ko dara display() funkcija?
bubu Posted August 27, 2004 Report Posted August 27, 2004 Eh, buus tev gandriiz pilla klase jaauzraksta: class table { var $code; function table($caption='') { $code = "<table caption='$caption'>"; // vai nu kaa tur bij, no galvas nezinu :) $code .= '<tr><th>Vārds</th><th>Uzvārds</th></tr>'; // šo der taisīt universālāk } function addrow($name, $surname) { $code .= '<tr><td>'.htmlspecialchars($name).'</td><td>'.htmlspecialchars($surname).'</td></tr>'; } function getHtml() // vai display { return $code.='</table>'; } } tā apmēram (negarantēju uz kļūdām :)
Sliipeetais Posted August 27, 2004 Author Report Posted August 27, 2004 Milzumliels paldies! Beidzot sapratu.
Sliipeetais Posted August 27, 2004 Author Report Posted August 27, 2004 (edited) ----- Edited August 28, 2004 by Sliipeetais
Sliipeetais Posted August 27, 2004 Author Report Posted August 27, 2004 (edited) OK, paldies jums abiem. Edited August 28, 2004 by Sliipeetais
Gacha Posted August 28, 2004 Report Posted August 28, 2004 Es te gugleju un atradu vienu, kas tev Sliipeetais varētu intresēt => šitas te links
Recommended Posts