user991830
user991830

Reputation: 894

joomla 3 php if else statement

I have the following statement in my Joomla 3 index.php file that I am trying to work out:

<?php if ($this->countModules('right')) : ?>
<?php if( JRequest::getVar( 'view' ) == 'article' ): ?>
  <div class="col-md-<?php echo $right; ?>">
    <section class="sidebar right-sidebar">
      <jdoc:include type="modules" name="right" style="standard" />
    </section>
  </div>
<?php endif; ?> 
<?php endif; ?>

I need to change the above statement so that the following happens:

Scenario 1

If nothing in the right position, remove all divs completely

Scenario 2

If module in the right position show module, but only on article pages - not on blog category page

PHP newbie - how would I do this statement?

Upvotes: 0

Views: 1049

Answers (1)

user2878988
user2878988

Reputation:

Did you try this:

<?php if( JRequest::getVar( 'view' ) == 'article' || $this->countModules('right') ): ?>
    <div class="col-md-<?php echo $right; ?>">
        <section class="sidebar right-sidebar">
            <jdoc:include type="modules" name="right" style="standard" />
        </section>
    </div>
<?php endif; ?> 

Upvotes: 1

Related Questions