Be aware the environment when you built a .Net application
During this year, that is a transition period from 32-bit to 64-bit. That should not be a problem in .Net application. .Net should be CPU Neutral. But sometimes, some.net dlls will call others native dlls, such as SQLite and some SQL special types. They are only for either 32-bit or 64-bit environment. Thus, please be aware of this issue.
JSON in Joomla
I am building a component using JSON in Joomla. That is very hard to do that. So far, I built in a view.json.php in views folder. But I could not call it. Well, that is easy! You just need to add a parameter ,format=json, in the url.
Good jQuery Drop down list
The traditional form drop down list is not very good for JSON and that is very hard to create some advanced css layout for it. So, I choose to use jQuery dropdown list. Finally, I shortlisted jALDropdown to be my choice. It supports JSON and CSS layout too! The documentation is comprehensive too!
There is no "Contains" in Javascript string
I used "Contains" method in C# whether the strings contains a keyword.
For example:
Code
string str = "string"; | |
if(str.Contains("str")) | |
{ | |
Console.Write("OK"); | |
} |
There is no such method, but you can "indexOf".
Code
var str = "string"; | |
if(str.indexOf("str")!= -1) | |
{ | |
alert("OK"); | |
} |
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