I have do the research with google and found that. Joomla itself don’t have refresh function for their application. But if I need do the refresh function with my component or module then how?
IN here, I found a simple way to let my application do the refresh with below code. and it work find in my component and module with Joomla 2.5.
$app = JFactory::getApplication();
$app->redirect(JUri::getInstance());
In Joomla the easy way to get complete site domain with the specified folder (if your joomla put in others folder). You can use
JURI::root() this function to get it.
How to use this feature:
echo 'Joomla root URI is '.JURI::root()."\n";
echo 'Joomla root URI (path only) is '.JURI::root( true )."\n";
echo 'Joomla root URI (path specified) is '.JURI::root( false, '/a-different-path' )."\n";
echo 'Joomla root URI (path only) (path specified) is '.JURI::root( true, '/a-different-path' )."\n";
echo 'Joomla root URI is '.JURI::root()."\n";
echo 'Joomla root URI (path only) is '.JURI::root( true )."\n";
Output
Joomla root URI is http://localhost/joomla15svn10812/
Joomla root URI (path only) is /joomla15svn10812
Joomla root URI (path specified) is http://localhost/a-different-path/
Joomla root URI (path only) (path specified) is /a-different-path
Joomla root URI is http://localhost/a-different-path/
Joomla root URI (path only) is /a-different-path
To set tinyMCE editor to full path or full absolute urls, inside tinyMCE.init add the “
relative_urls” params to and set the value to “
false“. Because this option is set to true by default.
relative_urls : false,
But in Joomla you are not allow directly change the javascript params to false. But you can pass the params in PHP when calling it.
Below is the example how to set the “relative_url” to false. and it work on Joomla2.5
$editor = JFactory::getEditor();
$params = array('relative_urls' => '0');
echo $editor->display('wrapper4_editor', $this->wrapper4content['content'], '100%', '400px', '', '', true,null, null, null, $params);
To use JPagination inside the application. You need include the pagination classes inside the application.
You can using jimport to include the Pagination classes.
jimport('joomla.html.pagination');
After that, pass the value to the class.
$total = 100; //the total number of items in a list
$limitstart = 0; //the offset of the item at which to start
$limit = 15; //the number of items to display per page
$pageNav = new JPagination($total, $limitstart, $limit);
After that, echo the pagination output using getListFooter.
echo $pageNav->getListFooter();
Now you can refresh the page and you will able see the pagination output as below:
For custom query in Joomla is not prevent the SQL injections issue. So that, we need to add some script to the query.
In Joomla we can using
$db->quote($param) to prevent SQL injections in custom query.
The Example of the query:
$db = JFactory::getDbo();
$query = "INSERT INTO table (`username`, `password`) VALUES (".$db->quote($username).", $db->quote($password))";
$db->setQuery($query);
$db->query();
In the query you not need to add
Single Quote Symbol. Because it will help you add in your query.