robb rich
robb rich
Offline
0
thank you for this very light and useful template setup. I have enjoyed working with it over the past couple of weeks and have only found one issue I am not sure how to best solve.

the blank template and also the bootstrap version allow for making as many module positions as you want, which is nice, but how do I make these so if they are NOT being uses, then the size of the remaining modules (or main content) will resize?

for example, the sidebar may not be needed on all pages. the bootstrap version of the template has the main content built to stay 8 columns wide - even if the side bar is not present.

I purchased your e-book, and there is a lot of great information in there, but I wasn't able to find what I was looking for - and think it would be a great addition.

I know how to write a php 'if' statement that will load the module if it's been assigned to any position on any page - I am just not sure how to do the resizing if that position is not needed.

thank you for your time
robb
Responses (2)
  • Accepted Answer

    Thursday, 07. April 2016, 18:54 - #permalink
    0
    Sidebar is there only if you add a module to that position/page.

    In your head you can put f.e.:


    // Adjusting content width
    if ($this->countModules('sidebar'))
    {
    $size= "col-md-8";
    }
    else
    {
    $size= "col-md-12";
    }






    And then in your body f.e.:

    <div class="row text">
    <div id="copy" class="<?php echo $size; ?>">
    <jdoc:include type="message" ></div>
    <jdoc:include type="component" ></div>
    <aside>
    <?php if ($this->countModules('sidebar')) : ?>
    <div class="col-md-4"><jdoc:include type="modules" name="sidebar" style="xhtml" ></jdoc:include></div>
    <?php endif; ?>
    </div>
    </aside>



    So when there is NO sidebar main content is 12 columns wide and sidebar is NOT displayed. If there is a sidebar your maincontent is 8 columns wide and the sidebar 4 columns. You can fiddle with the example.

    Does that help?

    Also you can give your divs IDs and make changes in your sylesheet to change markup. You need some knowledge about css then.

    Some info you may find here: http://stackoverflow.com/questions/22010918/bootstrap-3-1-how-to-use-mixin-make-grid-columns
    The reply is currently minimized Show
  • Accepted Answer

    Jonny
    Jonny
    Offline
    Sunday, 06. March 2016, 20:15 - #permalink
    0
    Hi,

    i am not sure if this is a solution for you, but maybe ;)


    <?php if ($this->countModules('sidebar')) { ?>
    <div class="container main">
    <div class="row">
    <div class="col-xs-12 col-sm-8 col-md-9 col-lg-9">
    <div class="content">
    <jdoc:include type="message" />
    <jdoc:include type="component" />
    </div>
    </div>
    </div>
    </div>

    <?php } else { ?>

    <!-- Just STARTSITE -->

    <div class="container start">
    <div class="row">
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <div class="content">
    <jdoc:include type="message" />
    <jdoc:include type="component" />
    </div>
    </div>
    </div>
    </div>

    <?php }; ?>



    You have to play with
    countModules
    and
    cols
    .

    Good luck! Best regards

    Jonny
    The reply is currently minimized Show
Your Reply