Skip to content

Instantly share code, notes, and snippets.

@jneubauer
jneubauer / gist:3025457
Created June 30, 2012 20:50
JFoobar item titles
in /components/com_yourcomponent/views/yourcomponents/tmpl/default.php on line 34:
change:
<?php echo $this->escape($item->title); ?>
to:
<a href="index.php?option=com_flashcards&view=flashcard&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->title); ?></a>
[
{"id":"AF","name":"Afghanistan","number":"","geometry":{"type":"Polygon","coordinates":[[[61.210817,35.650072],[62.230651,35.270664],[62.984662,35.404041],[63.193538,35.857166],[63.982896,36.007957],[64.546479,36.312073],[64.746105,37.111818],[65.588948,37.305217],[65.745631,37.661164],[66.217385,37.39379],[66.518607,37.362784],[67.075782,37.356144],[67.83,37.144994],[68.135562,37.023115],[68.859446,37.344336],[69.196273,37.151144],[69.518785,37.608997],[70.116578,37.588223],[70.270574,37.735165],[70.376304,38.138396],[70.806821,38.486282],[71.348131,38.258905],[71.239404,37.953265],[71.541918,37.905774],[71.448693,37.065645],[71.844638,36.738171],[72.193041,36.948288],[72.63689,37.047558],[73.260056,37.495257],[73.948696,37.421566],[74.980002,37.41999],[75.158028,37.133031],[74.575893,37.020841],[74.067552,36.836176],[72.920025,36.720007],[71.846292,36.509942],[71.262348,36.074388],[71.498768,35.650563],[71.613076,35.153203],[71.115019,34.733126],[71.156773,34.348911],[70.881803,33.988856],[69.930543,34.02

Keybase proof

I hereby claim:

  • I am jneubauer on github.
  • I am jonneubauer (https://keybase.io/jonneubauer) on keybase.
  • I have a public key whose fingerprint is 59D1 85B1 013D 1F7E B633 689D 1876 E896 AA9A 7850

To claim this, I am signing this object:

@jneubauer
jneubauer / edit.php
Last active August 29, 2015 14:25
Front End Editing Override
<!-- this goes in the template override(e.g., /templates/your-template/html/com_content/form/edit.php) -->
<!-- Instead of just this -->
<?php echo $this->form->renderField('field_name', 'attribs'); ?> <!-- displays a field already in the XML file -->
<!-- You need this -->
<!-- this part can be added anywhere in the file - preferrable towards the beginning, but definitely before the next part -->
<?php if ($this->item->id) : ?> <!-- checking if this is an existing article or not -->
<?php $attribs = json_decode($this->item->attribs); ?> <!-- if it is an existing article, get the attribs part of the existing record (attribs is where we save custom fields). You only need this line once. -->
<?php echo $this->form->setValue('field_name', 'attribs', $attribs->field_name); ?> <!-- set the value of the custom field to what is already saved. Duplicate for the number of fields you need, changing the field_name as needed. -->
<?php endif; ?>
@jneubauer
jneubauer / masterplugin.php
Last active February 16, 2018 20:25
Joomla! plugin that fires all possible plugin events
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
class PlgSystemMasterplug extends JPlugin
{
function onUserAuthenticate()
{
error_log('onUserAuthenticate', 0);
}
@jneubauer
jneubauer / .htaccess
Created September 15, 2015 17:02
example of additional htaccess condition preventing broken image and file links from getting routed to Joomla CMS
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder