Post by gulendam » Tue Oct 07, 2014 2:39 pm

1.5.x -2.0 What is the difference between the code structure.

sample
2.0 -> $data['heading_title'] = $this->language->get('heading_title');
1.5 -> $this->data['heading_title'] = $this->language->get('heading_title');
others ?

Newbie

Posts

Joined
Sun May 22, 2011 4:27 pm

Post by gulendam » Sat Oct 11, 2014 3:21 am

up

Newbie

Posts

Joined
Sun May 22, 2011 4:27 pm

Post by mithereal » Sun Oct 12, 2014 3:01 pm

Language Loading
1.5x => $this->language->load('module/module');
2.x =>$this->load->language('module/module');

Template Loading
instances of
$this->data
become
$data
1.5x =>
$this->data['heading_title'] = $this->language->get('heading_title');
$this->template = 'module/module.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
2.x =>
Route Method Data is passed from the controller to the view via local varibles
$data['heading_title'] = $this->language->get('heading_title');
$data['header'] = $this->load->controller('common/header');
column left is loaded via controller and should be placed in all modules
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
setOutput now part of the response class
$this->response->setOutput($this->load->view('module/module.tpl', $data));

Warning Declarations
1.5x=>
warnings were pulled from a global in the controller
and called in the view like

<?php if (isset($error_warning)) { ?>
2.x =>
warnings are local to the method
if (isset($this->error['warning'])) {
$data['error_warning'] = $this->error['warning'];
} else {
$data['error_warning'] = '';
}
in the view we have
<?php if($error_warning) { ?>

Redirects are now part of the response class
1.5x => $this->redirect($this->url->link('module/module', 'token=' . $this->session->data['token'] , 'SSL'));
2.x =>$this->response->redirect($this->url->link('module/module', 'token=' . $this->session->data['token'] , 'SSL'));

Admin Limit
1.5x => $this->config->get('config_admin_limit')
2.x => $this->config->get('config_limit_admin')

Admin View
views are comprised of panels your code will go inside one of these panels sometimes prefixed with default if its the default panel
for upgrading your 1.5 templates a loose guide to follow would be
add column left under the header ie replace

Code: Select all

<?php echo $header; ?>
with

Code: Select all

<?php echo $header; ?>
<?php echo $column_left; ?>
place filters in a div called well

Code: Select all

<div class="well">
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-name"><?php echo $entry_name; ?></label>
                <input type="text" name="filter_name" value="<?php echo $filter_name; ?>" placeholder="<?php echo $entry_name; ?>" id="input-name" class="form-control" />
              </div>
              <div class="form-group">
                <label class="control-label" for="input-model"><?php echo $entry_model; ?></label>
                <input type="text" name="filter_model" value="<?php echo $filter_model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
              </div>
            </div>
              <button type="button" id="button-filter" class="btn btn-primary pull-right"><i class="fa fa-search"></i> <?php echo $button_filter; ?></button>
            </div>
          </div>
        </div>
place tables inside divs with table-responsive class

Code: Select all

<div class="table-responsive">
<table class="table table-bordered table-hover">
 <thead>
 </thead>
<tbody>
</tbody>
</table>
Change Ckeditor script

Code: Select all

<?php foreach ($languages as $language) { ?>
CKEDITOR.replace('description<?php echo $language['language_id']; ?>', {
	filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
	filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
});
<?php } ?>
//--></script> 
to

Code: Select all

$('#description').summernote({height: 300});
Last edited by mithereal on Wed Nov 05, 2014 3:03 pm, edited 5 times in total.

User avatar
Newbie

Posts

Joined
Fri Mar 22, 2013 6:16 am

Post by gulendam » Sun Oct 12, 2014 9:06 pm

ok. thanks.
I am testing.

Newbie

Posts

Joined
Sun May 22, 2011 4:27 pm
Who is online

Users browsing this forum: No registered users and 168 guests