php - If/else statement inside the same div tag (formatting) -
absolute beginner here, bare me :) i'm trying formatting of php , html in same document right. can't seem conversion right. ....
this original html:
<div class="content-holder clearfix"> <div class="container"> <div class="row"> <div class="span12"> <div class="row"> <div id="title-header" class="span12"> <div class="page-header"> <?php get_template_part("static/static-title"); ?> </div> </div> <div class="row"> <?php if ($masonrycategory=='false') { ?> <div class="span8 <?php if (of_get_option('blog_sidebar_pos')==''){echo 'right';}else{echo of_get_option('blog_sidebar_pos'); } ?>" id="content"> <?php get_template_part("loop/loop-blog-main"); ?> </div> <div class="span4 sidebar" id="sidebar"> <?php dynamic_sidebar("hs_main_sidebar"); ?> </div> <?php }else{ ?> <div class="span12 id="content"> <?php get_template_part("loop/loop-blog-masonry"); ?> </div> <?php } ?> </div> </div> </div> </div> </div> </div>
and need convert php. ...
} else { echo "<div class='content-holder clearfix'>"; echo "<div class='container'>"; echo "<div class='row'>"; echo "<div class='span12'>"; echo "<div class='row'>"; echo "<div id='title-header' class='span12'>"; echo "<div class='page-header'>"; get_template_part("static/static-title"); echo "</div>"; echo "</div>"; echo "<div class='row'>" if ($masonrycategory=='false') { echo "<div class='span8' . 'if (of_get_option('blog_sidebar_pos')==''){echo 'right';}else{echo of_get_option('blog_sidebar_pos'); } ?>" id="content"> <?php get_template_part("loop/loop-blog-main"); ?> </div> <div class="span4 sidebar" id="sidebar"> <?php dynamic_sidebar("hs_main_sidebar"); ?> </div> <?php }else{ ?> <div class="span12 id="content"> <?php get_template_part("loop/loop-blog-masonry"); ?> </div> <?php } ?> </div> </div> </div> </div> </div> </div> } ?>
syntax error:
echo "<div class='span8' . 'if (of_get_option('blog_sidebar_pos')==''){echo 'right';}else{echo of_get_option('blog_sidebar_pos'); } ?>" id="content">
until more confident, might find easier more vebose in style of coding:
echo '<div class="span8'; if (of_get_option('blog_sidebar_pos') == '') { echo ' right'; } else { echo of_get_option('blog_sidebar_pos'); } echo '" id="content">';
Comments
Post a Comment