How to reference a javascript file in a Joomla Component
I am writing two Joomla components during these few days. I got a problem, how to reference a javascript file in a Joomla Component. I used to do it in a cowboy way. I hard coded the path in the template! I should keep it inside the component!
I found the documentation, in the framework, that is a method calls AddScript. It will add a script in the header section. That is nice!
Code
<?php | |
$document = &JFactory::getDocument(); | |
$document->addScript( 'components/com_<component name>/script/jquery.js' ); | |
?> |
But please adding this in the component xml file:
Code
<files folder="site"> | |
........ | |
<folder>scripts</folder> | |
</files> |
It makes sure the script folder will be deployed.
Reference:
Joomla Documentation
Getting upgrade to Joomla 1.7
I started to use Joomla 1.7. I found there is a lot of different aspects from Joomla 1.6. Some components are not working. All of templates I tried are not working in my Joomla 1.7 websites. Those templates are working fine in Joomla 1.5. I think Joomla group to consider deep on the backward compatibility. Thus, if you find a template, please make sure that is for Joomla 1.6+.
Joomla got Version 1.7
Not long ago, I was using Joomla 1.6 to build some websites. But yesterday, I found there is a new version of Joomla. That is so fast. Their upgrade lifecycle is very short. Are there many new features?
I found their website stated there are some enhancements. It has some security enhancements and better multi-languages support. If I have a new website to build, I definitely will use 1.7 to be CMS. But I don't feel very attractive to upgrade my Joomla 1.6 to 1.7.
Reference:
Joomla.org
PHP is still a good option.
I will consider PHP is a good option for building my applications. There are a lot of low cost PHP hosting. Moreover, many many good opensource projects in PHP are in the market. That is so easy to build an application. If I planned to implement some small scale applications, I will choose PHP as the platform.
One of my blogs is upgraded to WordPress 3.2.1
One of my blogs is upgraded to WordPress 3.2.1 during last week. That is very smooth. All I need is uploading the files to my home directory. Then Loading the homepage again, it will run the update script. That is so easy!
I found the interface got the big improvements. I love in this version, it has a top toolbar in the public frontend, after you logined. It got the shortcut to create a new post and display the number of comments are waiting for approval. That is so user-friendly!