In der Syntax.php das
elseif ($attribute == "tabelle") {
$tablecontent = "";
$j = 0;
preg_match_all("/(<|<<)(.*)(>|>>)/Umsie", $value, $tablelines);
foreach ($tablelines[0] as $tablematch) {
if (preg_match("/<<([^>]*)/Umsi", $tablematch)) {
$linecontent = preg_replace('/|/', '</th><th class="contenttable">', $tablelines[2][$j]);
$linecontent = preg_replace('/&/', '&', $linecontent);
$linecontent = preg_replace('/<(.*)/', "$1", $linecontent);
$tablecontent .= "<tr><th class="contenttable">$linecontent</th></tr>";
}
else {
$css = "contenttable1";
if ($j%2 == 0)
$css = "contenttable2";
$linecontent = preg_replace('/|/', '</td><td class="'.$css.'">', $tablelines[2][$j]);
$linecontent = preg_replace('/&/', '&', $linecontent);
$tablecontent .= "<tr><td class="$css">$linecontent</td></tr>";
}
$j++;
}
$content = str_replace ("$match", "<table class="contenttable" summary="">$tablecontent</table>", $content);
}
mit dem Ersetzen
elseif ($attribute == "tabelle" || substr($attribute,0,8) == "tabelle=") {
$tablecontent = "";
$zelle_nr = 1;
if(substr($attribute,0,8) == "tabelle=")
$css_clase = substr($attribute,8,strlen($attribute)-8);
else
$css_clase = "contenttable";
preg_match_all("/(<|<<)(.*)(>|>>)/Umsie", $value, $tablelines);
foreach ($tablelines[2] as $tablematch) {
if(strstr($tablematch,"<")) {
$tablematch = str_replace("<","",$tablematch);
$htmltag = "th";
}
else {
$htmltag = "td";
}
$tablezelle = explode("|",$tablematch);
$tablecontent .= "<tr>";
foreach ($tablezelle as $zelle) {
if($htmltag == "th")
$css = $css_clase;
else
$css = $css_clase.$zelle_nr;
$tablecontent .= "<".$htmltag." class="".$css."">$zelle</".$htmltag.">";
$zelle_nr++;
}
$tablecontent .= "</tr>";
$zelle_nr = 1;
}
$content = str_replace ("$match", "<table class="$css_clase" summary="">$tablecontent</table>", $content);
}
Für jede Spalte wird nun eine eigene Nummer erzeugt (contenttableNUMMER)
oder mit Eigener Klasse [tabelle=meinKlasse|.....] (meinKlasseNUMMER)
mfg. stefanbe
Der PHP-Code von stefanbe kann ergänzt werden, um zusätzlich auch wieder abwechselnde Zeilen (wie im Original) zu erhalten. Das CSS-Layout für die Zeilen wird in style.css nicht über die Klasse, sondern die ID definiert.
elseif ($attribute == "tabelle" || substr($attribute,0,8) == "tabelle=") {
// Tabelleninhalt aufbauen
$tablecontent = "";
$zelle_nr = 1;
$j = 0;
if(substr($attribute,0,8) == "tabelle=")
$css_clase = substr($attribute,8,strlen($attribute)-8);
else
$css_clase = "contenttable";
// Tabellenzeilen
preg_match_all("/(<|<<)(.*)(>|>>)/Umsie", $value, $tablelines);
foreach ($tablelines[2] as $tablematch) {
if(strstr($tablematch,"<")) {
$tablematch = str_replace("<","",$tablematch);
$htmltag = "th";
}
else {
$htmltag = "td";
}
$tablezelle = explode("|",$tablematch);
$tablecontent .= "<tr>";
// CSS-ID immer im Wechsel für unterschiedliche Zeilen
$cssid = $css_clase."1";
if ($j%2 == 0) $cssid = $css_clase."2";
$j++;
foreach ($tablezelle as $zelle) {
$zelle = trim($zelle);
if($htmltag == "th") {
$css = $css_clase;
$tablecontent .= "<".$htmltag." class="".$css."">$zelle</".$htmltag.">";
}
else {
$css = $css_clase.$zelle_nr;
$tablecontent .= "<".$htmltag." class="".$css."" id="".$cssid."">$zelle</".$htmltag.">";
}
$zelle_nr++;
}
$tablecontent .= "</tr>";
$zelle_nr = 1;
}
$content = str_replace ("$match", "<table class="$css_clase" summary="">$tablecontent</table>", $content);
}
In style.css kann dann z.B. stehen:
table.tabletn {
border-collapse : collapse;
margin-top : 20px;
}
th.tabletn {
vertical-align : top;
color : #FFFF99;
background-color : #339900;
border : 2px solid #339900;
padding : 2px 3px;
font-size : 17px;
}
#tabletn1 {
vertical-align : top;
border : 2px solid #339900;
background-color : #FFFF99;
padding : 2px 3px;
font-size : 17px;
}
#tabletn2 {
vertical-align : top;
border : 2px solid #339900;
background-color : #CCFF66;
padding : 2px 3px;
font-size : 17px;
}
td.tabletn1 {
text-align : center;
font-weight : bold;
}
Der Aufruf erfolgt dann mit
[tabelle=tabletn|...]
Ich bin so fit in PHP...
Sind die oben genannten Ergänzungen in der Syntax.php eigentlich in der 1.12.beta3 schon eingebaut?
Gruß aus Bochum,
Thorsten
ich glaube: JA!
(hab von php noch keine Ahnung)
die Klassen (siehe Screenshot) müssten zumindest reichen.
ja ist geht sogar mit eigenem classnamen [table=classname|..........
gruss stefanbe