Changing the ltr to rtl in front page

Changing the ltr to rtl in front page

by Tarek mouhandes -
Number of replies: 5

Hello

I'm trying to change the front page direction from ltr to rtl, but i can't do that.

I saw that the standard.php file in my theme/layout has a line:

<html <?php echo $OUTPUT->htmlattributes() ?>>

How can i change this attributes to the front page only please?

and there is a line:

<body id="<?php p($PAGE->bodyid); ?>" class="<?php p($PAGE->bodyclasses); ?>">

how we can change the body classes please?

or there onther way to do that?

Thanks a lot in advance

 

Average of ratings: -
In reply to Tarek mouhandes

Re: Changing the ltr to rtl in front page

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Are you intending to use a different language in the frontpage? If so then you could try adding a body class dir-rtl to the frontpage.php in your theme layout folder.

Where you find this code ... add the part highlighted in green...

$bodyclasses = array();
       $bodyclass[] = 'dir-rtl';
if ($showsidepre && !$showsidepost) {
    if $bodyclasses[] = 'side-pre-only';
} else if ($showsidepost && !$showsidepre) {
        $bodyclasses[] = 'side-post-only';
} else if (!$showsidepost && !$showsidepre) {
    $bodyclasses[] = 'content-only';
}

Average of ratings: Useful (2)
In reply to Mary Evans

Re: Changing the ltr to rtl in front page

by Tarek mouhandes -

Thanks a lot Mary your answer helps me too much, and I didn't find the frontpage.php file in my theme layout folder, instead i find the file: default.php in my layout folder, and it has the same lines you mentioned, but the highlighted line must be:

$bodyclasses[] = 'dir-rtl';

Thanks again

Tarek

In reply to Tarek mouhandes

Re: Changing the ltr to rtl in front page

by Tarek mouhandes -

Mary again i'm sorry; ihave another question about that:

but another question please the line you posted to me Add a class successfuly, but how can i remove a class from a body?

 

In reply to Tarek mouhandes

Re: Changing the ltr to rtl in front page

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

It all depends on which body class you are wanting to remove, as some come from within Moodle itself.

However if it is related to the Frontpage then you can override it with CSS. Infact you can override all the CSS on the front page by adding the following...

#page-site-index

or

.pagelayout-frontpage

So for the header you could have...

#page-site-index #page-header h1.headermain { float: right; text-align: right;}

.pagelayout-frontpage #region-pre .header .title h2 { float-right; text-align: right;}

So you don't really need dir-rtl, you can just add the styles that style it that way.

Cheers

Mary

Average of ratings: Useful (2)
In reply to Mary Evans

Re: Changing the ltr to rtl in front page

by Tarek mouhandes -

Thank you Mary your answers are very helpfull to me

Cheers

Tarek