After adding code to Additional HTML my site doesn't show

After adding code to Additional HTML my site doesn't show

by nolan damon -
Number of replies: 29

I have added code to the Head part of the additional html page.  Now my site doesn't show.  How can I remove the code.

I am using Moodle 3.6.4 with Essentials theme.

Nolan

Average of ratings: -
In reply to nolan damon

Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

Essential theme settings are found in
mdl_config_plugins

select * from mdl_config_plugins where plugin = 'theme_essential'

query above shows 1025 rows.


from command line:
mysql -u USER -p'PASSWORD' -e "use DATABASE4MOODLE;select * from mdl_config_plugins where plugin = 'theme_essential';" > ./essentsettings.txt;cat ./essentsettings.txt;wc -l essentsettings.txt

Look at the resulting essentsettings.txt file

In the site I was using to check info (can't share here cause it
has too much info tha needs to remain private, and for me, too much info period (am a function over form kinda guy) the text file had this which looks like the area you might have edited in settings to cause 'white screen of death'.   Your row 1147 might be different ...

1147    theme_essential    customcss    .dimmed,
\na.dimmed:link,
\na.dimmed:visited,
\na.dimmed_text,
\na.dimmed_text:link,
\na.dimmed_text:visited,
\na.dimmed_.categoryname,
\n.dimmed_text,
\n.dimmed_text a,
\n.dimmed_text a:link,
\n.dimmed_text a:visited,
\n.dimmed_text a{
\nfont-style: normal;
\ncolor: #999;
\n}
\n.usersuspended,
\n.usersuspended a,
\n.usersuspended a:link,
\n.usersuspended a:visited,
\n.dimmed_category,
\n.dimmed_category a {
\ncolor: #ececec;
\n}
\n.dimmed_text a {
\ncolor: #ececec;
\n}
\n/*.categoryname a:visited{
\n
\n*/
\n
\n
\n/*
\n
\nHide Top page block - This is good to go
\n
\n*/
\n.categorypicker {
\ndisplay: none;
\n}
\n#coursesearch {
\ndisplay: none;
\n}
\n.box generalbox info{
\ndisplay: none;
\n}
\n
\n.dimmed_category .info .categoryname a:visited{
\nfont-style: normal;
\ncolor: #ececec;
\n}
\n

Above is guess (probably wrong for your site).

Note and 2 cent advice: as I understand it, support for Essential theme is going away in higher versions of Moodle.  Might consider finding another theme now rather then get dependent on something you might not be able to fix in higher versions ... you can't stay at your version of Moodle for ever and ever ... you'll have to upgrade - sooner or later.

Good luck ...

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Thank you very much Ken. Will look into it now. This is the code I pasted into the HEAD section. When I did, I had trouble accessing my Question Bank. So I removed it, but it looks like I did not remove all of the code.
In reply to nolan damon

Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

What code did you add? 

And where did you go to remove it?  chopped URL please - browser history?

Ken


In reply to Ken Task

Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -

Hi Ken

This is what my website looks like now. Please see screenshot.

Attachment mywebsite.jpg
In reply to nolan damon

Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
This is where I included the code.
Attachment additional html.jpg
In reply to nolan damon

Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

Notwithstanding Ken’s comments about the Essential theme being deprecated, the Additional HTML settings are not tied to any one theme. Look in the mdl_config table and search the 'name' field for "additionalhtmlhead" - what you entered (or at least, what remains of what you entered) will be in the 'value' field 😊

Average of ratings: Useful (2)
In reply to Jon Bolton

Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

Ahhh ... What Jon said! smile  He is 100% correct!

That's what I get for responding to what seemed a plea in an un-solicited PM in an area (themes) where I claim I'd prefer not to mess with being a function over form kinda guy!

'SoS', Ken

Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Hi Jon

Thank you very much. I will look into it. The "mdl_config table" that's in the database connected to my Moodle site, right?
In reply to nolan damon

Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

Yes. Be VERY VERY careful editing anything directly in the database - but if your site is not accessible, you don't have much choice.

Average of ratings: Useful (1)
In reply to nolan damon

Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

I've just looked at your site, and the page is definitely loading with content, but there appears to be nothing within the <body> tags. All of your content is sitting in the head tag, so I think you have a missing tag somewhere.


screenshot

In reply to Jon Bolton

Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

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

Hi Jon,

From the page source it looks like there are more than one set of body tags!

here is one right at the end of the code.

In reply to Mary Evans

Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Thank you Mary.
In reply to Jon Bolton

Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Hi Jon

Where can I add or remove tags.
In reply to nolan damon

Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

Got command line?

Possible work-around to get site back if it was errant additional HTML - a character that doesn't show?

in moodlecode/admin/cli there is a cfg.php script that shows all settings.
php cfg.php |grep additional
begets 3 variables
additionalhtmlhead   
additionalhtmltopofbody   
additionalhtmlfooter

In config.php file of site one could add:

$CFG-> additionalhtmlhead="";
$CFG-> additionalhtmltopofbody="";
$CFG-> additionalhtmlfooter="";

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Hi Ken

Where do I need to add the above code. I have the config.php file open. It only has 27 lines in it.

It looks like this:

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = '';
$CFG->dbuser    = '';
$CFG->dbpass    = '';
$CFG->prefix    = '_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8_general_ci',
);

$CFG->wwwroot   = '';
$CFG->dataroot  = '/';
$CFG->admin     = '';

$CFG->directorypermissions = 

require_once(__DIR__ . '/lib/setup.php');
In reply to nolan damon

Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

After $CFG->admin     = ''; is a good place.

Am confused however, you say you are running php 7.1 - you mean you are now ... when last checked it was 7.3. 

I can see your site ... no white screen of death for me?????

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Yes I have changed it to 7.1 earlier. Thought it might change anything. How is it possible that you can see it and not me?
In reply to Ken Task

Re: Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Wow! Ken. That worked. Thank you so much. Thank you, thank you.
In reply to nolan damon

Re: Re: Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome.  BTW, as long as those lines are in config.php you will NOT be able to edit/add to those areas in the admin.  As far as those lines being responsible for fix ... maybe a factor ... maybe some task/cron kicked in to refresh cached theme info, etc.

Is it possible that someone else could see and you couldn't ... yes, cookies, caches ... browser caches as well as server caches and sessions.  Admin users are sometimes more afflicted than students/guest/others.   Comes with the territory of being an admin. sad

Anyhooo ... all is well that ends well, right? smile

'SoS', Ken



In reply to nolan damon

Re: Re: Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Nolan,
Why use the HEAD in the Additional HTML page to style your site, when the Essential theme contains a settings page where you can add your own custom CSS?
Cheers
Mary
Average of ratings: Useful (1)
In reply to Mary Evans

Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Thank you Mary. I will keep that in mind.
In reply to nolan damon

Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

Also ... is your version of PHP too high?

Server: Apache
X-Powered-By: PHP/7.3.5

https://docs.moodle.org/dev/Moodle_3.6_release_notes

PHP version: minimum PHP 7.0.0 Note: minimum PHP version has increased since Moodle 3.3. PHP 7.1.x and 7.2.x are supported too. PHP 7.3.x support is being implemented (@ MDL-63420) and not ready for production with this release.

https://tracker.moodle.org/browse/MDL-63420

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Hi Guys

Thank you for all your help. I am trying out all of your suggestions. One by one. Thus far nothing. Will let you know with screenshots what I have done thus far.
In reply to nolan damon

Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Hi Guys. I just deleted everything in the "additionalhtmlhead" in the mdl_config table. But I am still having the same problem. I am trying this one next:
In config.php file of site one could add:

$CFG-> additionalhtmlhead="";
$CFG-> additionalhtmltopofbody="";
$CFG-> additionalhtmlfooter="";
In reply to nolan damon

Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
I see that you've fixed it using Ken's suggestion - good stuff! But that proves that something in one of the additional html sections was the culprit. If you deleted everything in the mdl_config table for "additionalhtmlhead", then try the same on "additionalhtmltopofbody" and "additionalhtmlfooter".
Average of ratings: Useful (1)
In reply to Jon Bolton

Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by Ken Task -
Picture of Particularly helpful Moodlers

And when you do what Jon is suggesting make note in a text file (copy from field in DB to a text file) what it was you removed and share that info back here.

Am curious as to what caused it! smile

'SoS', Ken

In reply to Jon Bolton

Re: Re: Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
Hi Jon

Here is the steps I followed:

1. I opened my config.php file to get my database name.
2. Then I accessed "phpMyAdmin" in my control panel.
3. Found my database and accessed the "mdl_config table" searched for "additionalhtmlhead" by typing it in the name field.
4. When it (additionalhtmlhead) opened I clicked on edit and removed all the code that was in it.
5. I clicked on refresh and closed phpMyAdmin.
6. I then opened config.php again and add the following after admin"

$CFG-> additionalhtmlhead="";
$CFG-> additionalhtmltopofbody="";
$CFG-> additionalhtmlfooter="";

7. I saved it. That's it. When I refreshed my browser everything was back to normal.

Once again, thank you for your input. It really helped.
In reply to Ken Task

Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
I am currently running PHP 7.1.
In reply to nolan damon

Re: Re: Re: After adding code to Additional HTML my site doesn't show

by nolan damon -
This is the original code I added into the HEAD section of the additional HTML :

<link rel="stylesheet" href="https://use.typekit.net/shd8jlr.css">

<style>
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 150%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
-webkit-animation-name: fadeIn; /* Fade in the background */
-webkit-animation-duration: 0.4s;
animation-name: fadeIn;
animation-duration: 0.4s;
text-align: center;
margin: 0 auto;
}

/* Modal Content */
.modal-content {
text-align: center;
margin: 0 auto;
position: fixed;
bottom: 0;
background-color: #fefefe;
width: 150%;
-webkit-animation-name: slideIn;
-webkit-animation-duration: 0.4s;
animation-name: slideIn;
animation-duration: 0.4s
}

/* The Close Button */
.close {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}

.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}

.modal-header {
padding: 2px 16px;
background-color: #5cb85c;
color: white;
}

.modal-body {padding: 2px 16px;}

.modal-footer {
padding: 2px 16px;
background-color: #5cb85c;
color: white;
}

/* Add Animation */
@-webkit-keyframes slideIn {
from {bottom: -300px; opacity: 0} 
to {bottom: 0; opacity: 1}
}

@keyframes slideIn {
from {bottom: -300px; opacity: 0}
to {bottom: 0; opacity: 1}
}

@-webkit-keyframes fadeIn {
from {opacity: 0} 
to {opacity: 1}
}

@keyframes fadeIn {
from {opacity: 0} 
to {opacity: 1}
}
</style>

Can it mess-up my site that nothing shows?