nocniagenti Posted March 1, 2007 Share Posted March 1, 2007 OK friends I need a small if statemant to help me change width of the div's the explanation should be like this if user2 and user3 modules are published (this are 2 horizontal modules that are placed inside a div #mid width=950px ) user2 widht= 530px user3 width=390px if only user2 module is published user2 width=950px and finaly if only user3 module is published user3 width=950px this is what I have so far and only the first statmeant is working like it shold. the other 2 always stay at 532px or 390px depends if user3 or user2 is published only <?php $newsflash = 0; $banner= 0 ; if (mosCountModules('user2')) $banner++; if (mosCountModules('user3')) $newsflash++; if (( $newsflash == 1 ) || ( $banner == 1 )) { $newsflashdivwidth = '390px'; $bannerwidth = '532px'; } else if (( $banner == 1 ) || ( $newsflash == 0 )) { $bannerwidth = '950px'; } else if (( $banner == 0 ) || ( $newsflash == 1 )) { $newsflashdivwidth = '950px'; ?> and this is the call for user2 and user3 <!-- NEWSFLASH MODULES --> <?php if (mosCountModules('user2') || mosCountModules('user3')) { ?> <div id="midsh"> <div id="mid"><?php if (mosCountModules('user2')) { ?> <div id="banner" style="width:<?php echo $bannerwidth ?>;"> <?php mosLoadModules ( 'user2' ); ?></div><?php } ?> <?php if (mosCountModules('user3')) { ?> <div id="newsflash" style="width:<?php echo $newsflashdivwidth ?>;"> <?php mosLoadModules ('user3');?></div><?php } ?> </div> </div><?php } ?> thank you Quote Link to comment Share on other sites More sharing options...
btherl Posted March 2, 2007 Share Posted March 2, 2007 I think you just need && instead of ||. || means "or", && means "and" Quote Link to comment Share on other sites More sharing options...
nocniagenti Posted March 2, 2007 Author Share Posted March 2, 2007 love you guys both of you where right the last post made it work code looks like this now <?php $newsflash = 0; $banner= 0 ; if (mosCountModules('user2')) $banner++; if (mosCountModules('user3')) $newsflash++; if (( $newsflash == 1 ) && ( $banner == 1 )) { $newsflashdivwidth = '390px'; $bannerwidth = '532px'; } elseif (( $banner == 1 ) && ( $newsflash == 0 )) { $bannerwidth = '946px'; } elseif (( $banner == 0 ) && ( $newsflash == 1 )) { $newsflashdivwidth = '946px'; } ?> it was suposed to be && not || thank you!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.