Skip to content

Instantly share code, notes, and snippets.

@rvsjoen
rvsjoen / default.php
Created June 26, 2012 23:23
Frontend toolbar in Joomla!
<form method="post" action="index.php" id="adminForm">
<div id="toolbar-box"><?php echo $this->toolbar->render(); ?></div>
<input type="hidden" name="option" value="com_foo" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $this->item->id; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
@rvsjoen
rvsjoen / rest.txt
Created March 6, 2012 15:49
REST interface
### General requirements
- Should return 405 method not supported if the components do not provide controllers in the specified format
- Should work with and without SEF enabled, with and without htaccess
- Preferably implemented in a plugin so it can be easily disabled
- Uses OAuth2 for security
- The REST trigger should be configurable via parameter
- The format of the returned document is controlled by the HTTP Accept header
### URLs
@rvsjoen
rvsjoen / gist:1699501
Created January 29, 2012 16:24
Joomla! 1.7 to 2.5 upgrade issues
a. Copy the Joomla_2.5.0-Stable-Update_Package.zip to your root html folder.
b. Using the FTP File Manager, Unarchive this file. Check the Override Existing Files box.
c. After this completes, the site should load and should say 2.5.0 in the Site Information.
d. In the back end, go to Installation Manager: Database. It will likely show problems. Click Fix and it should fix the problems.
e. Go to Installation Manager: Discover and click Discover. It will likely show new extensions. Select them all and click Install. It should install the new 2.5 extensions.
f. At this point, everything should be OK except that it will still indicate that you need to update to 2.5.0 in the Update tab (even though you don't!). To fix this, you need to edit a row in the database.
g. Go to the phpMyAdmin and find the row in the #__extensions table where id=700. In the manifest_cache column, you will see the text:
"version":"1.7.3"
Change this to
"version":"2.5.0"
@rvsjoen
rvsjoen / gist:1440151
Created December 6, 2011 21:45
Loading jQuery in Joomla
$doc = JFactory::getDocument();
$doc->addScript('https://www.google.com/jsapi');
$doc->addScriptDeclaration('
google.load("jquery", "1.6.2", {uncompressed: true});
google.load("jqueryui", "1.8.15", {uncompressed:true});
');
$doc->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/themes/ui-lightness/jquery-ui.css');
@rvsjoen
rvsjoen / install.php
Created November 2, 2011 19:27
Automatic extension installation
<?php
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));