0

I'm working on the costume Joomla template and I'm overriding the footer I have a menu (footer_menu) when I sit

<jdoc:include type="modules" name="footer_menu" style="html5" /> 

in the index .php the menu appears, but when in, set it in my custom footer it not work

my footer.php :

<?php    
defined('_JEXEC') or die;
?>

<footer class="container shadow p-3 mb-2 bg-white rounded">

<div class="row mt-1">
        <div class="col">
                <!-- Menu Footer -->
                <jdoc:include type="modules" name="footer_menu" style="html5" /> 

        </div>
</div>
</footer>

</body>
</html>

index.php

<?php

defined('_JEXEC') or die;


/** @var JDocumentHtml $this */

$app  = JFactory::getApplication();
$user = JFactory::getUser();
$doc = JFactory::getDocument();






// Output as HTML5
$this->setHtml5(true);
// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');

if ($task === 'edit' || $layout === 'form')
{
    $fullWidth = 1;
}
else
{
    $fullWidth = 0;
}


// Add template js
JHtml::_('script', 'template.js', array('version' => 'auto', 'relative' => true));

// Add html5 shiv
JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9'));

// Add Stylesheets
JHtml::_('stylesheet', 'template.css', array('version' => 'auto', 'relative' => true));


?>



<!DOCTYPE html>
<html>

    <head>
        <title>Agma Theme</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    </head>

    <body>

        <header class="container shadow p-3 mb-2 bg-white rounded mt-3 " role="banner">
                <div class="row">   

                                    <nav class="nav">
                                        <jdoc:include type="modules" name="nav" style="html5" /> 
                                     </nav>
                                 <jdoc:include type="modules" name="search" style="html5" /> 
                </div>             

        </header>

        <div>

        </div>


        <jdoc:include type="modules" name="footer" style="html5" /> 



    </body>

</html>
  • How are you loading footer.php in index.php? Do you have any modules assigned to footer_menu position? – Sharky Aug 26 '18 at 17:50
  • yes using the same jdoc:include : – TheLordOne Aug 26 '18 at 17:59
  • Please update your question with relevant code from index.php. – Sharky Aug 26 '18 at 18:11
  • It is because you are giving the name of the menu in place of module position. – Pratyush Aug 26 '18 at 18:24
0

Using jdoc:include to include footer.php won't work. It's used to create module positions. So this code creates a module position called footer:

<jdoc:include type="modules" name="footer" style="html5" /> 

You can now assign modules to footer position. Note that footer.php is not loaded in this case. And it's not really needed unless you want to split your template into several files for organizing, reusability, etc.

So what you can do is keep it that way, just wrap it with code from footer.php for styling:

<footer class="container shadow p-3 mb-2 bg-white rounded">
<div class="row mt-1">
        <div class="col">
                <!-- Menu Footer -->
                <jdoc:include type="modules" name="footer" style="html5" /> 

        </div>
</div>
</footer>

You can, of course, change the name of position to footer_menu or anything else.

But if you need to include PHP files inside index.php, use native include or require, e.g.:

include 'footer.php';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.