开发者

php echoing <div> in wrong place

i am working on an an options panel for a wordpress theme. this problem has started since i tried trying to add jquery, but it doesn't seem like it should be a jquery problem.. and doesn't go away when i delete all my jquery scripts.

anyway PHP determines whether the page was saved, reset, etc and displays an appropriate message at the top of the page. but for some reason, my div (Which ought to appear first) is appearing after my h2 in the #info div that is several lines below. it isn't a css abs positioning issue as when i view source the #message div is contained w/in #info even though it appears first in the and as far as i can tell all my div tags are opened and closed correctly. this behavior resolves if i get rid of the 'updated' class. i don't desperately need to maintain that class (i can just create a new one w/ similar attributes) but i am baffled as to why the heck the php is firing incorrectly.

<?php
  if ($_REQUEST['saved']) {
    ech开发者_StackOverflowo '<div id="message" class="updated fade"><p><strong>' . $my_themename . ' ' . __('settings saved.', 'thematic') . '</strong></p></div>';
  }
  if ($_REQUEST['reset']) {
    echo '<div id="message" class="updated fade"><p><strong>' . $my_themename . ' ' . __('settings reset.', 'thematic') . '</strong></p></div>';
  }
  if ($_REQUEST['reset_widgets']) {
    echo '<div id="message" class="updated fade"><p><strong>' . $my_themename . ' ' . __('widgets reset.', 'thematic') . '</strong></p></div>';
  }
  if ($_REQUEST['error']) {
    echo '<div id="message" class="updated fade"><p><strong>The file you submitted was not a valid image type.</strong></p></div>';
  }
  if ($_REQUEST['imgremoved']) {
      echo '<div id="message" class="updated fade"><p><strong>'. __('Image Removed') .'</strong></p></div>';
  }
  if ($_REQUEST['imgsaved']) {
      echo '<div id="message" class="updated fade"><p><strong>'. __('Image Uploaded') .'</strong></p></div>';
  } 
?>
<div id="saved"></div>
<div id="header" class="clearfix">
<div id="themelogo"><img src="<?php echo CHILDTHEME_URI .'/functions/css/images/logo.png';?> " / ></div>
<div id="info">
<h1><?php echo $my_themename; ?></h1>
<h2>Built on the Thematic Theme Framework</h2>
</div>

</div>


Not really a solution for the reported behaviour, but noticed a small section of code which may be better expressed differently:

<div id="themelogo"><img src="<?php echo CHILDTHEME_URI .'/functions/css/images/logo.png';?> " / ></div>

Might be better as:

<div id="themelogo"><img src="<?php echo CHILDTHEME_URI; ?>'/functions/css/images/logo.png" /></div>

Just one of those things - I am used to debugging code by reading it and trying to optimise it as I go. I presume the affected file is not available anywhere online for us to review and see the error for ourselves?


One thing that might be worth looking into is whether you are including css files from the jqueryui library. I know I have on several occasions experienced formatting issues when including that css.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜