Changing the ltr to rtl in front page

Changing the ltr to rtl in front page

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

 

評比平均分數: -
In reply to Tarek mouhandes

Re: Changing the ltr to rtl in front page

Mary Evans發表於

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';
}

評比平均分數:Useful (2)
In reply to Mary Evans

Re: Changing the ltr to rtl in front page

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

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

Mary Evans發表於

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

評比平均分數:Useful (2)