milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home

CodeIs CodeHighlighter

Details
Written by: Stanko Milosev
Category: Extensions
Published: 18 December 2011
Last Updated: 12 November 2012
Hits: 6075

Just downloaded and installed it from here. You have to enabled it from plugins, and also, enable language which you want to use (Delphi is not enabled by default).

Example:

<pre class="brush:LanguageAlias"> 
  put your magic code here 
</pre>

From here Brushes you can find here

Call to undefined method JException::setQuery()

Details
Written by: Stanko Milosev
Category: Extensions
Published: 08 April 2009
Last Updated: 30 November -0001
Hits: 10259

If you are receiving error like this:

Call to undefined method JException::setQuery()

Check connection to your database (if it is different then Joomla!).

If everything is ok, then try something like it is described here.

CRUD with JTable

Details
Written by: Stanko Milosev
Category: Extensions
Published: 22 August 2008
Last Updated: 30 November -0001
Hits: 8536

CRUD (Create Read Update Delete) is the name given to the four common data manipulation tasks.

The first thing we need to do in our class is to define the public properties. The public properties relate directly to the fields and must have exactly the same names. We use these properties as a 'buffer' to store individual records.

The second thing we need to do is to define the constructor. In order to use the JTable::getInstance() method, we must override the JTable constructor with a constructor that has a single referenced parameter, the database object.

The third thing we need to do is override the check() method. This method is used to validate the buffer contents, returning a Boolean result. If a check() fails we use the setError() method to set a message that explains the reason why the validation failed.

/**
* #__myextenstion_foobars table handler
*
*/
class TableFoobar extends JTable
{
/** @var int Primary key */
var $id = null;
/** @var string Content */
var $content = null;
/** @var int Checked-out owner */
var $checked_out = null;
/** @var string Checked-out time */
var $checked_out_time = null;
/** @var string Parameters */
var $params = null;
/** @var int Order position */
var $ordering = null;
/** @var int Number of views */
var $hits = null;
/**
* Constructor
*
* @param database Database object
*/
function __construct( &$db )
{
parent::__construct('#__myextension_foobars', 'id', $db);
}
/**
* Validation
*
* @return boolean True if buffer is valid
*/
function check()
{
if(!$this->content)
{
$this->setError(JText::_('Your Foobar must contain some
content'));
return false;
}
return true;
}
}

Now CRUD:

$table->reset();
$table->set('content', "Lorem ipsum dolor sit amet");
$table->set('ordering', $table->getNextOrder());
if ($table->check())
{
if (!$table->store())
{
// handle failed store
// use $table->getError() for an explanation
}
}
else
{
// handle failed check
// use $table->getError() for an explanation
}

So, we have following methods:

set - set data in table
load - loads data from table
delete - delete records from table

Taken from book Packt Publishing Mastering Joomla 1.5 Extension and Framework Development.

Component you can download from here. Table you will must to create by your self.

Adding javascript to Joomla!

Details
Written by: Stanko Milosev
Category: Extensions
Published: 20 August 2008
Last Updated: 29 October 2009
Hits: 6425

If you want to add your javascript to Joomla! header from your component, you can do it like this:

JHTML::_('behavior.mootools');
$doc =& JFactory::getDocument();
$js = "

function show(options)
{
$('update').innerHTML = '<div align=".'"center"'."><img src="/.'"images/ajax-loader.gif" width="66" height="66"/>'."<p/>Prosim poÄŤakajte</div>'
var ajaxRequest = new Ajax('index.php', {
method: 'get',
onComplete: function(response) {
$('update').innerHTML = response;
}
});
ajaxRequest.request(options);
}

window.addEvent('domready', function()
{
$('form1').addEvent('submit', function(e)
{ $('update').innerHTML = '<div align=".'"center"'."><img src="/.'"images/ajax-loader.gif" width="66" height="66"/>'."<p/>Prosim poÄŤakajte</div>'
// Stop the form from submitting
new Event(e).stop();
// Update the page
this.send({ update: $('update') });
});
});";
$doc->addScriptDeclaration($js);

Javascript in component you can add only once, if you try to do it twice, one javascript will be overwriten with another.Â

  1. Ajax and custom function.
  2. Component name
  3. Ajax finally.
  4. Creating components

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 85 of 168

  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89