Aligning and centrering logging block with Table in frontpage topic

Aligning and centrering logging block with Table in frontpage topic

by Mari Cruz García -
Number of replies: 4

Hello,

I would like to canvass the opinion of the Moodle web designers community about something that I have recently implemented in our Moodle frontpage, as the solution is not 100% smart:

I have created a different logging and landing page in our test site. The landing page is the page that users see once they log in.

This is the logging page:

https://testlz.health.org.kw/

(it is a self-certificate, but it is safe).

and the landing page is based on My Moodle.

I want to revamp the whole theme as ours is not based on bootstrap, but there is no time for it in the next weeks, as we are enrolling students starting a new full time MSc, so we want to share the logging page between students belonging to different programmes and, once they logging, each student can only see their courses in My Moodle page.

The table displayed in the logging page has been created manually from the html editor in the topic section of the frontpage .


In the original theme, the block 'logging'  was not aligned with the topic section. It was separated and on the top left corner. In other to centre the logging and navegation block, what I have done is:

1)  Edit the file mytheme/layout/frontpage.php

adding the following:

<!--HEADER>

....


<!-- START OF CONTENT -->

<?php if ($hascustommenu) { ?>

      <div id="custommenu"><?php echo $custommenu; ?></div>

<?php } ?>

<div class="navbar clearfix">

<?php if ($hasnavbar) { ?>

<div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>

<div class="navbutton"> <?php echo $PAGE->button; ?></div>

<?php } ?>

</div>

<div id="page-content-wrapper">

    <div id="page-content">

        <div id="region-main-box">

            <div id="region-post-box">

                <div id="region-main-wrap">

                    <div id="region-main">

                        <div class="region-content">

                       <!--MCG the image shouldn't be displayed here<img src="/theme/aridhia_khn/pix/headerImage.jpg" id="headerImage" /> -->





                            <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>

                        </div>

                    </div>

                </div>

                <?php if ($hassidepre) { ?>

                <div id="region-pre" class="block-region" style="padding-top:65px; left:100px;">

                    <div class="region-content">

                    <?php echo $OUTPUT->blocks_for_region('side-pre') ?>

                    </div>

                </div>

                <?php } ?>

                <?php if ($hassidepost) { ?>

                <div id="region-post" class="block-region">

                    <div class="region-content">

                        <?php echo $OUTPUT->blocks_for_region('side-post') ?>

                    </div>

                </div>

                <?php } ?>

            </div>

        </div>

    </div>

</div>

<!-- END OF CONTENT -->

<!--FOOTER>


However, this solution:

         <div id="region-pre" class="block-region" style="padding-top:65px; left:100px;">


is giving me a lot of problems with different screen sizes and browser zoom settings.

Even if I set the following option in pageout.ccs

/*MCG the table in logging page disappears with screen size */




@media screen and (max-width:1000px) { 

  .no-overflow {

display: none !important;

}


}

You will see that the pictures in the table overlap the logging block at some point.


Is it possible to find a smarter solution which will not depend on screen size or browser font size or zoom settings?

Thank you very much for your advice.

Mari Cruz


Average of ratings: -
In reply to Mari Cruz García

Re: Aligning and centrering logging block with Table in frontpage topic

by Mary Evans -

Hi Mari Cruz,

What version of Moodle are you using as the MAIN_CONTENT_TOKEN in the code you have posted is really  outdated and is now depreciated as of Moodle 2.2.

But to answer your question, you cannot, and should not , add inline styles to this type of layout as it is too finely tuned in CORE css. It would actually be easier if you used just some basic HTML and CSS, or even borrow some Bootstrap grid system and styles.

Cheers

Mary

In reply to Mari Cruz García

Re: Aligning and centrering logging block with Table in frontpage topic

by Mary Evans -

The easiest thing to do with this if the frontpage before login is only going to have the Navigation block and the Login block plus the table you added to site topic area. If you calculate the space that table need plus the block which is I think 200px you are perhaps talking about the page width ot round about 800px approx.

So remove the inline style from the side block. Make sure you have no other blocks visible on the frontpage. And add CSS in the theme custom CSS box if there is one, or the stylesheet with this CSS that will style the page.

#page-site-index.notloggedin #page { width: 800px; margin: 0 auto; }

This will make the frontpage centered and have sufficient room for your table.

Cheers

Mary

In reply to Mary Evans

Re: Aligning and centrering logging block with Table in frontpage topic

by Mari Cruz García -

Hello Mary,


Thanks for your prompt answer. You are right: the theme that we are using in our site (which is Moodle 2.6.5) was developed by Moodle 2.0. That is why I want to revamp it although I have already done some patches to it.

What you mention about incorporating some of the grids of bootstrap is something that I already tested. However, I want to revamp the whole theme, starting from a simple reliable one such as Clean or Aarvard.


I am going to try your suggestions tomorrow when I work for the Kuwait project again.


Again, thank you very much.

Mari Cruz

In reply to Mari Cruz García

Re: Aligning and centrering logging block with Table in frontpage topic

by Mari Cruz García -

Hello Mary,

I have deleted all the in-line style changes in frontpage.php and tried your suggestion, but it didn't work.

However, what it has worked is the following change I implemented in the theme pagelayout.css


The original setting was:

.side-pre-only #page-content #region-pre {

left: 1%;

width: 21%;

}


and I changed to

.side-pre-only #page-content #region-pre {


    left: 100px;

width: 21%;

margin-top:65px;

}


I am trying to identify if other pages in Moodle may be also affected by this change,