Controller PHP
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Accessories extends CI_Controller {
function _remap($method_name = 'index')
{
if(!method_exists($this, $method_name)){
$this->index();
}
else{
$this->{$method_name}();
}
}
function __construct()
{
parent::__construct();
$this->load->model('accessories_model','',TRUE);
}
function index()
{
//echo "index";
//exit;
$link = $this->uri->segment(2);
//echo "<br/>";
//echo $link;
//exit;
/*$accessories = $this->accessories_model->getdata('tbl_accessories_master');
if(!empty($accessories) && count($accessories) > 0)
{
//echo "<pre>";
//print_r($accessories);
foreach($accessories as $key => $val)
{
$updateData = array();
$updateData["link"] = (str_replace(' ', '-', strtolower($val['accessories_name'])));;
$this->db->where("accessories_id",$val['accessories_id']);
$this->db->update("tbl_accessories_master",$updateData);
}
} */
if(!empty($link))
{
//echo "done";
//exit;
$data['accessories'] = $this->accessories_model->getdata('tbl_accessories_master','link',$link);
if(is_array($data['accessories']))
{
$data['accessory_images'] = $this->accessories_model->getdata('tbl_accessories_images','accessories_id',$data['accessories'][0]['accessories_id']);
//echo "<pre>";
//print_r($data);
//exit;
$this->load->view('template/header.php');
$this->load->view('accessories/index',$data);
$this->load->view('template/footer.php');
}
else
{
$this->load->view('template/header.php');
$this->load->view('template/no-result.php');
$this->load->view('template/footer.php');
}
}
else
{
$this->load->view('template/header.php');
$this->load->view('template/no-result.php');
$this->load->view('template/footer.php');
}
}
}
?>
Index.php from views
<div class="container-fluid">
<?php
if(!empty($accessories) && !empty($accessories[0]['accessories_banner_image']))
{
?>
<div class="row">
<div class="col-sm-12 pl0 pr0">
<div class="product-banner-bg">
<img src="<?php echo base_url(); ?>images/accessories_images/<?php echo $accessories[0]['accessories_banner_image']; ?>" alt="" title="" class="img-responsive"/>
</div>
</div>
</div>
<?php
}
?>
<div class="clearfix"></div>
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="product-hd">Accessories</div>
<div class="medium-hd"><?php echo $accessories[0]['accessories_name']; ?></div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="content">
<?php echo html_entity_decode($accessories[0]['accessories_description']);
/*<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac libero vitae ligula fringilla sollicitudin non in lacus.
Aliquam non nulla at nisi maximus pharetra id at sapien. Pellentesque ullamcorper imperdiet ex. Praesent eu finibus nisl, id viverra
mauris. Sed iaculis erat a dolor mattis eleifend. Integer dolor augue, fermentum sed mauris a, pretium ornare ligula. Fusce ut
orci sem. Curabitur sit amet neque sit amet erat scelerisque iaculis. </p>-->*/ ?>
</div>
</div>
</div>
<?php
if(!empty($accessory_images) && count($accessory_images) > 0)
{
?>
<div class="row">
<div class="col-sm-12">
<div class="medium-hd"></div>
<div class="content">
<div id="links-install" class="links">
<?php
$accessory_img_cnt = 0;
foreach($accessory_images as $acc_img)
{
$accessory_img_cnt = $accessory_img_cnt + 1;
?>
<div class="col-sm-3 mt15 mb15 product-border">
<a href="<?php echo base_url(); ?>images/accessories_images/<?php echo $acc_img['accessories_image']; ?>" title="Accessory image <?php echo $accessory_img_cnt; ?>">
<img src="<?php echo base_url(); ?>images/accessories_images/<?php echo $acc_img['accessories_image']; ?>" alt="Accessory image <?php echo $accessory_img_cnt; ?>" class="img-responsive">
</a>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
if(!empty($accessories[0]['accessories_pdf_file']))
{
?>
<div class="row">
<div class="col-sm-12">
<div class="medium-hd"></div>
<div class="content">
<?php
if(!empty($accessories[0]['accessories_pdf_file']))
{
?>
<div class="bullet-box-content">
<a href="<?php echo base_url(); ?>images/accessories_images/pdf/<?php echo $accessories[0]['accessories_pdf_file']; ?>" target="_blank">View Drawing</a>
</div>
<?php
}
if(!empty($accessories[0]['accessories_zip_file']))
{
?>
<div class="bullet-box-content">
<a href="<?php echo base_url(); ?>images/accessories_images/zip/<?php echo $accessories[0]['accessories_zip_file']; ?>" target="_blank">2D Drawings</a>
</div>
<?php
}
if(!empty($accessories[0]['accessories_fitting_pdf_file']))
{
?>
<div class="bullet-box-content">
<a href="<?php echo base_url(); ?>images/accessories_images/pdf/<?php echo $accessories[0]['acccesories_fitting_pdf_file']; ?>" target="_blank">View Fitting Instructions</a>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
}
?>
</div>
<script>
document.getElementById('links-install').onclick = function (event)
{
event = event || window.event;
var target = event.target || event.srcElement,
link = target.src ? target.parentNode : target,
options = {index: link, event: event},
links = this.getElementsByTagName('a');
blueimp.Gallery(links, options);
};
</script>
I also have files in my dashboard but they seem to be working