PHP gevorderde |
|
Hoi, hier ben ik weer, ben al aan het knoeien geweest met array's maar dan worden andere gedeeltes codes langer. Is het nu aan te raden de onderstaande code toch proberen in een multi array te steken of maakt hat eigenlijk niet uit als ik het als volgd doe:
<?php
$iconen = array("bold", "italic", "underline", "overline", "underlineoverline", "unorderdlist", "listitem", "orderdlist", "alignleft", "aligncenter", "alignright", "alignjustify", "url", "urlwithdescription", "mail", "code", "mailwithdescription", "mailwithurl", "image", "imagewithdescription", "colorcan", "color", "colorswatch", "colorwheel", "cross", "edit", "eye", "font", "lock", "lockopen", "pencil", "plaatscode", "quote", "strikethrough", "searchbin", "search", "tick", "wikipedia", "wikipedia1", "google", "yahoo", "ask", "amazon", "php", "mysql", "live", "msn");
$colorfields = array("r_off" => 224, "g_off" => 223, "b_off" => 227, "r_on" => 255, "g_on" => 255, "b_on" => 255);
?>
<body bgcolor="black" text="#FFFFFF">
<?php
$arr = array();
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$kleur_off = trim($_POST['kleur_off']);
$kleur_on = trim($_POST['kleur_on']);
$size_off = trim($_POST['size_off']);
$size_on = trim($_POST['size_on']);
if (!empty($kleur_off) && !empty($kleur_on)) {
$rgb = new color_function($kleur_off);
list($r_off, $g_off, $b_off) = $rgb->hex_to_rgb();
$rgb = new color_function($kleur_on);
list($r_on, $g_on, $b_on) = $rgb->hex_to_rgb();
} elseif (! empty($kleur_off)) {
$rgb = new color_function($kleur_off);
list($r_off, $g_off, $b_off) = $rgb->hex_to_rgb();
$r_on = trim($_POST['r_on']);
$g_on = trim($_POST['g_on']);
$b_on = trim($_POST['b_on']);
if (empty($r_on)) $r_on = 255;
if (empty($g_on)) $g_on = 255;
if (empty($b_on)) $b_on = 255;
} elseif (! empty($kleur_on)) {
$rgb = new color_function($kleur_on);
list($r_on, $g_on, $b_on) = $rgb->hex_to_rgb();
$r_off = trim($_POST['r_off']);
$g_off = trim($_POST['g_off']);
$b_off = trim($_POST['b_off']);
if (empty($r_off)) $r_off = 224;
if (empty($g_off)) $g_off = 223;
if (empty($b_off)) $b_off = 227;
} else {
foreach ($_POST as $key => $value) {
if (in_array($key, array_keys($colorfields))) {
$value = trim($value);
if (!empty($value)) {
$arr[] = $value;
} else {
$arr[] = $colorfields[$key];
}
}
}
list($r_off, $g_off, $b_off, $r_on, $g_on, $b_on) = $arr;
}
if (empty($size_off)) $size_off = 22;
if (empty($size_on)) $size_on = 22;
foreach($iconen as $icoon ) {
echo '<img src="create_off.php?icoon=' . $icoon . '&size=' . $size_off . '&r=' . $r_off . '&g=' . $g_off . '&b=' . $b_off . '" style="display: none;" />';
echo '<img src="create_on.php?icoon=' . $icoon . '&size=' . $size_on . '&r=' . $r_on . '&g=' . $g_on . '&b=' . $b_on . '" style="display: none;" />';
}
?>
<?php $iconen = array("bold", "italic", "underline", "overline", "underlineoverline", "unorderdlist", "listitem", "orderdlist", "alignleft", "aligncenter", "alignright", "alignjustify", "url", "urlwithdescription", "mail", "code", "mailwithdescription", "mailwithurl", "image", "imagewithdescription", "colorcan", "color", "colorswatch", "colorwheel", "cross", "edit", "eye", "font", "lock", "lockopen", "pencil", "plaatscode", "quote", "strikethrough", "searchbin", "search", "tick", "wikipedia", "wikipedia1", "google", "yahoo", "ask", "amazon", "php", "mysql", "live", "msn"); $colorfields = array("r_off" => 224, "g_off" => 223, "b_off" => 227, "r_on" => 255, "g_on" => 255, "b_on" => 255); ?> <body bgcolor="black" text="#FFFFFF"> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { $kleur_off = trim($_POST['kleur_off']); $kleur_on = trim($_POST['kleur_on']); $size_off = trim($_POST['size_off']); $size_on = trim($_POST['size_on']); $rgb = new color_function($kleur_off); list($r_off, $g_off, $b_off) = $rgb->hex_to_rgb(); $rgb = new color_function($kleur_on); list($r_on, $g_on, $b_on) = $rgb->hex_to_rgb(); } elseif (! empty($kleur_off)) { $rgb = new color_function($kleur_off); list($r_off, $g_off, $b_off) = $rgb->hex_to_rgb(); $r_on = trim($_POST['r_on']); $g_on = trim($_POST['g_on']); $b_on = trim($_POST['b_on']); if (empty($r_on)) $r_on = 255; if (empty($g_on)) $g_on = 255; if (empty($b_on)) $b_on = 255; } elseif (! empty($kleur_on)) { $rgb = new color_function($kleur_on); list($r_on, $g_on, $b_on) = $rgb->hex_to_rgb(); $r_off = trim($_POST['r_off']); $g_off = trim($_POST['g_off']); $b_off = trim($_POST['b_off']); if (empty($r_off)) $r_off = 224; if (empty($g_off)) $g_off = 223; if (empty($b_off)) $b_off = 227; } else { foreach ($_POST as $key => $value) { $arr[] = $value; } else { $arr[] = $colorfields[$key]; } } } list($r_off, $g_off, $b_off, $r_on, $g_on, $b_on) = $arr; } if (empty($size_off)) $size_off = 22; if (empty($size_on)) $size_on = 22; foreach($iconen as $icoon ) { echo '<img src="create_off.php?icoon=' . $icoon . '&size=' . $size_off . '&r=' . $r_off . '&g=' . $g_off . '&b=' . $b_off . '" style="display: none;" />'; echo '<img src="create_on.php?icoon=' . $icoon . '&size=' . $size_on . '&r=' . $r_on . '&g=' . $g_on . '&b=' . $b_on . '" style="display: none;" />'; } ?>
@sitecrew: Wat is eigenlijk het max aantal regels code toegelaten om in een topic te posten?? Ze hebben mij gezegt max: 80 en dan liever op plaatscode echter krijg je dan dikwijls minder respons. De luie mensen toch he
|