On Sun, Feb 22, 2009 at 5:23 PM, Justin Leniger <[email protected]> wrote:
> Hello everyone. I am using PHP to make several boxes appear, but you can
> save which ones you need to appear to a cookie.
> It currently only works with the default of 6 boxes.
> It's working like this:
>
> <div class="l">
> some stuff
> </div>
> <div class="r">
> some stuff
> </div>
> <div class="c">
> some stuff
> </div>
> <div class="l">
> some stuff
> </div>
> <div class="r">
> some stuff
> </div>
> <div class="c">
> some stuff
> </div>
>
> The problem is, when one or more box isn't there, or there is an
> additional one, the whole thing falls apart.
>
> Here is my relevant CSS:
>
> #container {
> padding:14px;
> width:729px;
> height:420px;
> margin-left:auto;
> margin-right:auto;
> border:1px solid white;
> background-color:#000;
> }
>
> .l {
> width:231px;
> float:left;
> padding:5px;
> }
>
> .c {
> width:231px;
> padding:5px;
> margin-left:242px;
> }
>
> .r {
> width:231px;
> float:right;
> padding:5px;
> }
>
> How can I get it to work, even if I remove or add boxes?
> ______________________________________________________________________
> css-discuss [[email protected]]
> http://www.css-discuss.org/mailman/listinfo/css-d
> List wiki/FAQ -- http://css-discuss.incutio.com/
> List policies -- http://css-discuss.org/policies.html
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
>

On the PHP side, instead of :

if (condition) {
echo '<div class="c">', $content, '</div>';
}

use:

echo '<div class="c">'
if (condition) {
 echo $content;
}
echo '</div>';

That way, the <div> will still be there, just without any content.

-Casey
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to