I am trying to edit my index.php file in my website using the Joomla! extension manager. I have to add the code right before my closing tag however there is no HTML! So I've tried adding some, after closing the PHP section but as soon as I save it - there's an internal server error.
"""
<?php
* Define the application's minimum supported PHP version as a constant so it can be
referenced within the application.
*/
define('JOOMLA_MINIMUM_PHP', '5.3.10');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
{
die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this
version of Joomla!');
}
$startTime = microtime(1);
$startMem = memory_get_usage();
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
JDEBUG ? JProfiler::getInstance('Application')->setStart($startTime, $startMem)-
>mark('afterLoad') : null;
$app = JFactory::getApplication('site');
$app->execute();
"""
So I have tried this:
"""
<?php
* Define the application's minimum supported PHP version as a constant so it can be
referenced within the application.
*/
define('JOOMLA_MINIMUM_PHP', '5.3.10');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
{
die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this
version of Joomla!');
}
$startTime = microtime(1);
$startMem = memory_get_usage();
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
JDEBUG ? JProfiler::getInstance('Application')->setStart($startTime, $startMem)-
>mark('afterLoad') : null;
$app = JFactory::getApplication('site');
$app->execute();
<!DOCTYPE html>
<html>
<body>
<script></script>
</body>
</html>
"""
Yes I did put the actual script code in, for this question I just put the script tag. I am trying to add hubspot webchat by this script:
"""
<script type="text/javascript" id="hs-script-loader" async defer
src="//js-na1.hs-scripts.com/********.js"></script>
"""
******** are numbers that I edited out