Post by alex067 » Sat Aug 12, 2017 9:39 am

Hi everyone. I have a custom page which needs to display images, but I am having trouble displaying anything at all! The page follows the same method as the account/download.php sript: https://ibb.co/bKj9SF

As you can see, it is empty because the values I want to output are not showing.

Here is the code for the custom page:
<?php
class ControllerCustomViewCode extends Controller
{
public function index()
{
if (!$this->customer->isLogged())
{
$this->session->data['redirect'] = $this->url->link('account/download', '', true);

$this->response->redirect($this->url->link('account/login', '', true));
}
$this->load->language('custom/viewcode');
$this->document->setTitle($this->language->get('heading_title'));

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('Account'),
'href' => $this->url->link('account/account', '', true)
);

$data['breadcrumbs'][] = array(
'text' => $this->language->get('Downloads'),
'href' => $this->url->link('account/download', '', true)
);


$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');

$data['images'] = array();

$id = $_GET['download_id'];
$showDate = $_GET['show_date'];
$dir = glob('QrImages/'.$id.'/'.$showDate.'/*.*');
$count = 1;
foreach ($dir as $image)
{
$data['images'][]= array(
'index' => $count,
'image' => $image);
$count++;
}


$this->response->setOutput($this->load->view('custom/view_code', $data));



}

As you can see, I am simply trying to output: an integer value, and the image which is obtained from a folder. I tried removing the image and just outputting the integer value, but still nothing shows!

Here is the .twig file for the custom page:
{{ header }}
<div id="custom-viewcode" class="container">
<ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %}
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
{% endfor %}
</ul>
<div class="row">{{ column_left }}
{% if column_left and column_right %}
{% set class = 'col-sm-6' %}
{% elseif column_left or column_right %}
{% set class = 'col-sm-9' %}
{% else %}
{% set class = 'col-sm-12' %}
{% endif %}
<div id="content" class="{{ class }}">{{ content_top }}
<h2>{{ heading_title }}</h2>
{% if images %}
<div class="table-responsive">
<table class="table table-bordered table-hover">
<tbody>
{% for displayImage in images %}
<tr>}
<td class="text-left">{{ displayImage.index }}</td>
<td><img src="'displayImage.image'" /><br /></td>
</tr>
{% endfor %}
</tbody>

</table>
</div>

{{ content_bottom }}</div>
{{ column_right }}</div>
</div>
{{ footer }}




}



The only reason I'm posting this question again is because for some reason you can't reply on the forums..

New member

Posts

Joined
Wed Jul 12, 2017 9:50 am
Who is online

Users browsing this forum: Landmaster and 10 guests