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 ?
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
with
place filters in a div called well
place tables inside divs with table-responsive class
Change Ckeditor script
to
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; ?>
Code: Select all
<?php echo $header; ?>
<?php echo $column_left; ?>
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>
Code: Select all
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
</thead>
<tbody>
</tbody>
</table>
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>
Code: Select all
$('#description').summernote({height: 300});
Last edited by mithereal on Wed Nov 05, 2014 3:03 pm, edited 5 times in total.
Who is online
Users browsing this forum: No registered users and 168 guests