How to add a new module position in Joomla 2.5? - joomla2.5

How to add a new module position in Joomla 2.5?
I want to add a new module position in one template, but I don't know how to do that.

To add new module position in your template, you need to add position in the templateDetails.xml and then in your index.php add that position where you want to show your module.
And after that in module manager select that position you have added for that module and check it.
For example:
In templatedetails.xml, locate the <positions></positions> start and end tags, then add inside:
<position>newposition</position>
In index.php, locate the place in the template where you wish to put the new position and insert:
<jdoc:include type="modules" name="newposition" />
For more details you can check this link:
How do you add a new module position?

Also, if you're doing it in some dark and dirty place, where you can't use directives (or shouldn't),
that's the simpliest way:
<?php
jimport( 'joomla.application.module.helper' );
$modules = JModuleHelper::getModules( 'your_position_name_that_you_just_enter_in_admin_ui' );
foreach($modules as $mod )
{
//var_dump($mod);
echo JModuleHelper::renderModule( $mod );
}
?>

Related

Remove header and footer from Joomla 2.5 home page

I have a Joomla 2.5 page consisting of a logo graphic and an entry button which I want to use as the home page. I've pretty much sorted out how to remove the menu module from this page but I want to remove the header and footer too but I can't see how. I would guess, perhaps wrongly, that changes need to be made in the template (beez20) index.php but what exactly? There seems to be plenty of advice online about removing either header/footer from all pages but not for a single page. Any help would be much appreciated
If header and footer are parts of design and not modules, you have to make an addition to template index.php to disable these parts.
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() != $menu->getDefault()) :
?>
<p> This will be hidden from frontpage </p>
<?php
endif;
?>
You could check this tutorial to help you how to determine if user is viewing the front page for all joomla versions and the addition that is needed for multilingual sites: How to determine if the user is viewing the front page

Add a new field in virtuemart new product form

I want to add a new field in virtuemart new product form, how can i do that ?
I add:
var $is_act = 1;
in "components\com_virtuemart\tables\products.php"
And
<?php echo VmHTML::checkbox('is_act', $this->product->is_act); ?>
And in database but what is appear is a checkbox without a string behind it, what is the wrong ?!
The VMHTL::checkbox function just create a check box without strings.
If you want to add string behind it you have to do something like this.
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_IS_ACT') ?>
<?php echo VmHTML::checkbox('is_act', $this->product->is_act); ?>
And then COM_VIRTUEMART_PRODUCT_IS_ACT should be added inside language file too.
for more clearness just check VM default product_edit_information.php page inside
administrator/components/com_virtuemart/views/product/tmpl/
Hope its helps..

Opencart how to add php code to product/category description

Does anyone know how to, without purchasing an addon/extension, add php code to the product and category descriptions? If you try to add it automatically gets commented out when you save, e.g. <!-- <?php echo "test" ?> -->
Workaround: For anyone else.. I used borderless iframe to include an external .php file which contained the php code I needed ....

Joomla 2.5 set module only on homepage

Hello am developer no administrator i have problem with my website (e-shop).
I use HikaShop componetn on my site and want to show last products on home page.
In Home page i add module and set position, and set in configuration to be visible only on HOME page. But dont work. I configure in administration where is visible where is not visible.
I try in my index manual to add
<div id="wraper">
<jdoc:include type="message" />
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault())
{?>
<jdoc:include type="modules" name="position-10" /><?php
} ?>
<jdoc:include type="component" />
</div><!--END OF WRAPER -->
I have top menu (HOME, AboutUs, Product, Contact) and when i click on About us and other page in top menu that module is not visible work fine. But on site i have sidebar where i show product categories. And there is problem, when i click on catetogy last product module is visible there.
Example:
--> TOP Menu
example.com -> TRUE = Module Last Product is Visible
example.com/index.php/abut-us -> FALSE = Module Last
Product is not Visible
example.com/index.php/product -> FALSE = Module Last
Product is not Visible
example.com/index.php/contact -> FALSE = Module Last
Product is not Visible
--> SIDEBAR
example.com/category/17-fishing-road -> TRUE = Module Last
Product is Visible
in all category is visible but i configure only on homepage
And in all sidebar is visible. Any idea how to fix this and put visible only on
example.com/index.php (HOMEPAGE)
Try this:
if(JRequest::getVar('view') == "frontpage" ) {
//You are in!
}
else {
//You are out!
}
The assignment of modules is done via the Module Manager, not the template index.php
Sp, go to the Module Manager (backend), open the module you want to assign, in the bottom left you can select which menu items you want to assign it to.
If it doesn't work using this method, then there must be something wrong with your site.
Hope this helps

templates in symfony

Hy,
I'm look for a way to do this on symfony:
I've to use a "box" a bit every where on my site... this box is resizable ... so the html/css is not simple... and i don't want to copy/paste it every where and the content of this box is not constant at all... so its not possible to make a partial template with a object variable... and pass all the content on a variable it's a bit annoying.
someyhing like this would be great:
<?PHP begin("mytemplate") ?>
"html content"
<?PHP end ?>
thanks for your help
Everywhere you need this "box" try this:
include_partial('mymodule/mypartial', array('variable1' => 'value1', 'variable2' => 'value2'));
and in your "mymodule/templates/_mypartial.php" use it like:
<div class="box"><?php echo $variable1 ?></div>
If you don't want to use partials you can use components and define each variable into the component action. Check Symfony's Components Slots (this is for v1.2 but works in v1.4).