Hi,
i'm a beginner on working with Joomla, the Gantry-Framework and PHP :) and i have a question about how to edit the html of the mainbody file. Or, to say it closer, before i want/could edit it i have to understand the code of the file and because of that i have a question.
The Goal that i want to achieve is: The Gantry-Framework uses a grid with 12-column layout. The mainbody section consisting of content-top, mainbody, content-bottom and a sidebar (see here). Now, i want to change the HTML that i only have the mainbody section at all. I think this i already achieved, but now the problem already exist, is that i want the mainboy-section to fit with the width of the whole 12 columns and not only 6 like at the moment. When i examine the site with developer tools of chrome i can see, that there are only 6-grid column layout is used an when i manually change it i achieve my goal, but now i want to edit the template and there i not really understand what to do.
This is the original code:
<?php
defined('GANTRY_VERSION') or die();
gantry_import('core.gantrylayout');
class GantryLayoutBody_MainBody extends GantryLayout {
var $render_params = array(
'schema' => null,
'pushPull' => null,
'classKey' => null,
'sidebars' => '',
'contentTop' => null,
'contentBottom' => null
);
function render($params = array()){
global $gantry;
$app = JFactory::getApplication();
$fparams = $this->_getParams($params);
$display_mainbody = !($gantry->get("mainbody-enabled",true)==false && $app->input- >getString('view') == 'featured');
$display_component = !($gantry->get("component-enabled",true)==false && ($app->input->getString('option') == 'com_content' && $app->input->getString('view') == 'featured'));
ob_start();
?>
<?php if ($display_mainbody) : ?>
<div id="rt-main" class="<?php echo $fparams->classKey; ?>">
<div class="rt-container">
<div class="rt-grid-<?php echo $fparams->schema['mb']; ?> <?php echo $fparams- >pushPull[0]; ?>">
<?php if (isset($fparams->contentTop)) : ?>
<div id="rt-content-top">
<?php echo $fparams->contentTop; ?>
</div>
<?php endif; ?>
<?php if ($display_component) : ?>
<div class="rt-block">
<div id="rt-mainbody">
<div class="component-content">
<jdoc:include type="component" />
</div>
</div>
</div>
<?php endif; ?>
<?php if (isset($fparams->contentBottom)) : ?>
<div id="rt-content-bottom">
<?php echo $fparams->contentBottom; ?>
</div>
<?php endif; ?>
</div>
<?php echo $fparams->sidebars; ?>
<div class="clear"></div>
</div>
</div>
<?php endif; ?>
<?php
return ob_get_clean();
}
}
and i changed it to:
<?php
defined('GANTRY_VERSION') or die();
gantry_import('core.gantrylayout');
class GantryLayoutBody_MainBody extends GantryLayout {
var $render_params = array(
'schema' => null,
'pushPull' => null,
'classKey' => null,
'sidebars' => '',
'contentTop' => null,
'contentBottom' => null
);
function render($params = array()){
global $gantry;
$app = JFactory::getApplication();
$fparams = $this->_getParams($params);
$display_mainbody = !($gantry->get("mainbody-enabled",true)==false && $app->input->getString('view') == 'featured');
$display_component = !($gantry->get("component-enabled",true)==false && ($app->input->getString('option') == 'com_content' && $app->input->getString('view') == 'featured'));
ob_start();
?>
<?php if ($display_mainbody) : ?>
<div id="rt-main" class="<?php echo $fparams->classKey; ?>">
<div class="rt-container">
<div class="rt-grid-<?php echo $fparams->schema['mb']; ?> <?php echo $fparams->pushPull[0]; ?>">
<?php if ($display_component) : ?>
<div class="rt-block">
<div id="rt-mainbody">
<div class="component-content">
<jdoc:include type="component" />
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="clear"></div>
</div>
</div>
<?php endif; ?>
<?php
return ob_get_clean();
}
}
There i dont't understand:
• fparams contains some parameter? for example 'mb' or 'pushpull'? But where it is filled? • I think mb contains the value 6...but there i want a 12 -> where i have to change it?
I hope i've described my problem in a way that you understood and somebody can help me. In addition i hope i formatted the code in my article correctly - i tried my best and uses the given tools in the menubar but i don't write many articles yet. So, if there are mistakes i apologize for it and would be glad when somebody tells me how to make it better, so i could write following posts in a better way.
After a little research by myself i realized something new:
Ok,i cleared all caches and then when i checked the configuration under the layout-settings of the template,i realized,that my settings won't be saved.When i choose position 1 and the slider under the selection of the position is set to 12(the only value which is valid when position 1 is chosen)i click on button save.first the configuration are correct,but when i close the template manager and open it again i find under layout->mainbody positions the old values.Then postion is 2 and the slider value under it is 6|6.Now im not sure if it is possible to reach my needs.But why it will be offered?
I look forward to hearing from you!
Best Regards,
Dennis