Joomla 2.5, Accessing template parameters in component's template - joomla

What is the correct way to access template parameters in components template in Joomla 2.5?
There are something implementations for earlier versions of Joomla but not for 2.5.
http://forum.joomla.org/viewtopic.php?p=2166990#p2166903

I think this might be what you're looking for:
$app = JFactory::getApplication();
$template = $app->getTemplate(true);
$params = $template->params;
$variable = $params->get('variable');

Related

how to give the url in joomla supporting form

I’m new to joomla and I’m using joomla 2.5. I need to redirect the page in joomla to another page. I saw that JROUTE is used for giving urls in joomla. but it start only from joomla folder. I need to get a file in the path
http://localhost/joomla/images/uploads/file.pdf
how can I write the above URL in joomla standard format?? can I use JURI base with jroute ??
Try this,
echo JURI::root().'images/uploads/file.pdf'
JURI::root() will return the site url.
If you required physical path try JPATH_SITE
Hope it helps..

Get the default language in the site frontend of joomla 2.5

How do I get the default language in the site frontend of Joomla 2.5?
After hours of reading through web and sources, I found this would be the correct answer:
JComponentHelper::getParams('com_languages')->get('site')
Try this
$lang =& JFactory::getLanguage();
echo 'Current language is: ' . $lang->getName();
http://docs.joomla.org/JFactory/getLanguage
For more details Click here
To get the users language on Joomla 3 you can do
JFactory::getUser()->getParam('language', JFactory::getLanguage()->getTag());

Load page title in joomla 2.5 content

I am looking for a way to load a page title in the Joomla 2.5 content for SEO purposes. I know in joomla you can use a function to load a module such as {loadposition box1}.
Is there a way to have a feature or does anyone know an extension so you can do something similar to this {loadpagetitle}.
This will save me hours of work.
Thanks.
Firstly, install the Direct PHP plugin and enable it.
Then copy and paste the following code into your article:
<?php
$mydoc = JFactory::getDocument();
$mytitle = $mydoc->getTitle();
echo $mytitle;
?>
Make sure you use the php tags though.
Hope this helps. Regards.

How to include javascript in Joomla virtuemart product details

I am actually customizing product details page with the help of http://virtuemart.net/documentation/Developer_Manual/Modifying_the_Layout.html this page. I need to include some external and internal JavaScript.But don't know were to add script.Please some one help me to do this.
To modify product details page . i just worked in following file components/com_virtuemart/themes/default/templates/product_details/flypage.tbl.php.
Virtuemart version is VirtueMart 1.1.9 stable
Joomla Version is Joomla! 1.5.15 Stable
Thanks In advance.
Based on your responses in the comments here is the answer:
//This line defines what JavaScript file you wish to add, change it as needed.
$myJsFile = JURI::Base() . 'templates/my_template_name/js/myJsFile.js';
//this line fetchs the jdocument object which is needed to add items to the head (amongst other things)
$document =& JFactory::getDocument(); //Drop the & if PHP5
//This line adds the previously setup JS url
$document->addScript($myJsFile);
If you want to add or something custom like IE conditional tags then see here for more info: http://docs.joomla.org/Adding_JavaScript_and_CSS_to_the_page on how to use this object.

Disable MooTools in VirtueMart

I'm creating a custom module for displaying VirtueMart categories, but need to disable VirtueMart from loading MooTools because it uses an older version of MooTools than what I need. I've searched everywhere, but I can't seem to find the file or function that will allow me to disable it. Any help would be greatly appreciated.
At least in virtuemart 1.5 go to
components/com_virtuemart/themes/YOURTHEME/theme.php
find line about 37, there is a function:
function vmTheme() {
parent::vmTemplate();
vmCommonHTML::loadMooTools();
}
Just comment
vmCommonHTML::loadMooTools();
The only reference to it in the entire project is in mod_virtuemart_currencies.xml. I'm not 100% familiar with Joomla, but this looks like an installer file for a particular currency module.
I'd suggest removing that module, or updating the reference to the MooTools library it's using inside that XML file (line 30 in the currently available version, inside modules/mod_virtuemart_currencies_1.14.j15/mod_virtuemart_currencies.xml).
I was able to resolve my issue. My custom module was using JHTML::script() to load my JavaScript files. That particular function has a third parameter that defaults to true that will automatically load MooTools. You can see the documentation here: http://docs.joomla.org/Adding_JavaScript
If that doesn't do it, put this in your template and it will remove any of the default scripts that Joomla tries to use. Obviously this might remove things necessary for Virtuemart to work right, but it might solve your problem too.
<?php
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headers = $this->getHeadData();
$headers['scripts'] = array();
$this->setHeadData($headers);
}
?>
I created a custom component for front and back ends, and I couldn't (for the life of me) disable mootools. I tried unsetting headers array and all that, and it didn't work!
It worked fine for regular pages where the component was a regular article, but not when it's my custom component.
I was using the JHTML::script() function in my template, and after reading one of the comments here, I tried adding a second parameter (FALSE) to the function and it worked!
Thank you!!!
Any ideas why unsetting mootools from the $document variable's _scripts array doesn't work with custom components?

Resources