General Question

webmasterwilliam's avatar

CSS <div> issue.

Asked by webmasterwilliam (165points) August 16th, 2008

Suppose I have the following setup

<div id=“leftColumn”>
  <div id=“leftChild1”><?php require(“include/errorMsg.inc”) ?></div>
  <div id=“leftChild2”><?php require(“ads/googleAd1.inc”) ?></div>
</div>

<div id=“rightColumn”>
  <div id=“rightChild1”><?php require(“include/article1.inc”) ?></div>
  <div id=“rightChild2”><?php require(“include/article2.inc”) ?></div>
</div>

<div id=“centerColumn”>
  <?php
    if ($mode=“a” {
      require(“include/form_a”);}
   else {
      require(“include/form_b);}
   ?>
</div>

Now suppose that leftChild1 is an error display module and is only to be inserted if there is an error detected in the code that is building the main content by the php code form_a or form_b.

Since the form code in the centerColumn is beyond the leftChild1 element, is there a way to define the leftColumn container early and then later insert the children divs into it depending upon the need?

Observing members: 0 Composing members: 0

4 Answers

richardhenry's avatar

Hmm… not quite sure what you mean… whatever it is, I wonder if you’re taking the complicated option? It certainly seems like you are. Perhaps try simplifying your layout.

Tone's avatar

Not 100% sure what you’re trying to do, but it sounds like you want the error display to happen dynamically, without a page reload, right? Otherwise, you’d just write out the error div using php (or whatever) depending on your validation of the form input. If this needs to happen without a page refresh, then you’d use Javascript/Ajax to add child nodes to the leftColumn element after you do some server-side processing.

webmasterwilliam's avatar

What I’ve decided to do was perform all the content processing prior to creating any html. The content will be written to a $content variable which will be displayed in whatever order the page needs. This way, my error message can come before the content, even though the content is what created it. ;-)

mirza's avatar

@webmaster: You should consider getting an accunt at Designer’s Talk – its a forum dedicated to helping people with such problems

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther