5 - Site side - Data entry

In site side you may want to allow user to insert data by a form. May be you now are thinking to use the same xml file by adding a new fieldset (say 'set5') and use again the plugin to remove the other fieldsets... smile

It's up to you. No one knows better than you how to optimize your extensions but yes, BPLibrary add a lot of new options.

components / com_dealer / car / view.html.php


<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');



/**
 * View file | site side
 */
 
class DealerViewCar extends JViewLegacy
{
    protected 
$item;    
    
    public function 
display($tpl null
    { 
        
        
// get form
        
$this->form    $this->get('Form');
        
        
//get the item
        
$this->item      $this->get('Item');

        
$this->form->bindJArrayHelper::fromObject$this->item));

        
// you may want to add a custom tag in header section
        
Bp::addHeadTag('<meta property="og:image" content="http://www.mysite.com/images/my_image.png">');

        
// you may want to load a javascript file
        
Bp::addJava('media/com_dealer/js/my_javascript_file.js'true);
        
        
// you may want to add a java code to the header section
        
$javaCode '<script type="text/javascript"> myJavaFunction(){ domything; }</script>';
        
Bp::addJavaCode($javaCode);

        
// you may want to display a message to the user
        
Bp::addMexBp::txt('COM_DEALER_MY_MESSAGE_TO_USER'), 'notice');

        
// you may want to detect the user's device to use the proper layout
        
$this->device Bp::getDevice();

        
// you may want to get the currently selected language object
        
$this->lang Bp::getLang();

        
// you may want to know only the tag of currently selected language
        
$this->langTag Bp::getLang('tag');

        
// you may want to use the current component params
        
$this->componentParams Bp::getParamsC();

        
// you may want to get the user component params
        
$this->userComponentParams Bp::getParamsC('users');

        
// you may want to get Joomla params
        
$this->joomlaParams Bp::getParamsJ();

        
// HAVE A LOOK INSIDE Bp CLASS FOR THE COMPLETE METHODS LIST
        // AND MORE TO COME...

        // PROCESS THE PLUGIN
        
$this->prms = new stdClass();
        
JPluginHelper::importPluginBp::getComponent() );
        
$dispatcher JEventDispatcher::getInstance();
        
$results $dispatcher->trigger'on'.ucfirst(Bp::getComponent()).ucfirst(Bp::getView()).'DataPrepare'
                                            
, array( &$this->form, &$this->prms ) );

        
parent::display($tpl);
    }    
}
// pure php no tag

Note how many common actions you can do with only one class: Bp. You don't have to remember all the core CMS different classes anymore. Be focused only on what make difference in your wallet: your core extensions!

Didn't realize so far how much time you waste after the core CMS's classes and methods, lacks of instruction, deprecated instructions, instructions that leave you even more confused... how much money has all this cost you so far?

More methods are coming soon...