|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/laciasmara.com/public_html/shop/application/controllers/ |
Upload File : |
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Manuals extends Public_Controller
{
function __construct()
{
parent::__construct();
$this->load->library('VisitorTracking');
$this->load->model('product_manuals_m');
}
public function view($slug)
{
if (!$slug) {
show_404();
return;
}
$this->visitortracking->trackVisitor();
// Load language
if ($this->session->userdata('site_lang') == 'english') {
$this->lang->load('mainpage', 'english');
} else {
$this->lang->load('mainpage', 'indonesian');
}
// Load model
$this->load->model('product_manuals_m');
// Get manual by slug
$manual = $this->product_manuals_m->get_by_slug($slug);
// Check if manual exists
if (!$manual) {
show_404();
return;
}
// Check if file exists
if (!file_exists(FCPATH . $manual->file_path)) {
$this->session->set_flashdata('error', 'Manual file not found');
redirect('manuals');
return;
}
// Increment view count
$this->product_manuals_m->increment_view_count($manual->id);
// Prepare meta data for SEO
$meta_title = $manual->title . ' - Product Manual';
$meta_description = 'View and download ' . $manual->title . ' manual guide. Version ' . $manual->version . '.';
// Limit meta description to 160 characters
if (strlen($meta_description) > 160) {
$meta_description = substr($meta_description, 0, 157) . '...';
}
// Set page data
$this->data['browser_title'] = $meta_title;
$this->data['meta_description'] = $meta_description;
$this->data['manual'] = $manual;
$this->data['canonical_url'] = base_url('manuals/view/' . $slug);
// Load view
$this->load->view('manuals/index', $this->data);
}
}