How to add php file into "columns2.mustache" file

How to add php file into "columns2.mustache" file

by Mark Brand -
Number of replies: 6

Hello Friends,

Please help me. How can i add a php file into "columns2.mustache" file (into <head> tag). I am using boost theme moodle 3.4 version.

<head>

    <title>{{{ output.page_title }}}</title>

    <link rel="shortcut icon" href="{{{ output.favicon }}}" />

    {{{ output.standard_head_html }}}

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Google web fonts -->

    <?php require_once(dirname(__FILE__).'/fonts.php'); ?>

</head>

Below is my code into fonts.php file

<?php if($PAGE->theme->settings->font_body == 11 || $PAGE->theme->settings->font_heading == 16) { ?>

<link href="//fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet" type="text/css">

<?php } ?>

<?php if($PAGE->theme->settings->font_body == 12 || $PAGE->theme->settings->font_heading == 18) { ?>

<link href="//fonts.googleapis.com/css?family=Vollkorn" rel="stylesheet" type="text/css">

<?php } ?>


Thank you,

Advance.

Attachment screen.png
Average of ratings: -
In reply to Mark Brand

Re: How to add php file into "columns2.mustache" file

by Mark Brand -

Hi Friends,

Below code into CSS file is not working. Please help me.

h1,h2{

  font-family: "setting:headingfont", sans-serif;

}


Thank you,

Advance


In reply to Mark Brand

Re: How to add php file into "columns2.mustache" file

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

Hi, 

Where exactly are you adding this CSS? I mean which file?

In reply to Mary Evans

Re: How to add php file into "columns2.mustache" file

by Mark Brand -

Hello Mary and Richard,

Thank you for your reply. Actually i create a style folder into boost theme and create a custom.css. And here into this file i put this css. But it's not working.

Please help me.



In reply to Mark Brand

Re: How to add php file into "columns2.mustache" file

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

OK...first of all you are running the risk of breaking your Moodle site if you begin to make changes to the Boost theme.

If anything you would be better off if you downloaded a copy of the Photo theme and use that as your site theme. 

Theme_Photo was made so that we developers can see how to make a child theme from Boost. The added beauty of the Photo theme, is that you can add photo images as backgrounds for different pages, but looks and works like Boost.

Going back to your question about the Custom CSS. If it is in boost/style/custom.css stylesheet then have you included that file name into the config.php under...https://github.com/lazydaisy/moodle/blob/master/theme/boost/config.php#L30

FOR EXAMPLE:

$THEME->sheets = [ 'custom' ];

Be careful in what you are doing as it could end up a complete catastrophe!

Mary

In reply to Mark Brand

Re: How to add php file into "columns2.mustache" file

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

You need to do the conditional work in the layout file and then pass the result into the mustache template.

Average of ratings: Useful (1)