bogdan_uman
@bogdan_uman
шлЫмазл неукЪ-поцЪ

Роутинг на кастомною страницу?

Здравствуйте, подскажите пожалуйста,. Создал свою касмотною страницу,
в контроллере и во вьюшке сделал файлы по инструкции, но как в меню сделать что бы была ссылка автомататически в меню

<ul class="main-navigation">
	...
		<li><a href="{{ guarantee }}">{{ text_guarantee }}</a></li>    
		<li><a href="{{ contact }}">{{ text_contact }}</a></li>
  </ul>


Для contact ссылку создает, а для guarantee нет. Если на страницу сделать прямой переход, через адресную строку браузера, то все работает /index.php?route=information/guarantee

catalog/controller/guarantee.php
<?php
class ControllerInformationGuarantee extends Controller {
	public function index() {
		// Optional. This calls for your language file
		$this->load->language('information/guarantee');
		
		// Optional. Set the title of your web page
		$this->document->setTitle($this->language->get('heading_title'));

		// Breadcrumbs for the page
		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);
		
		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('information/guarantee')
		);

		// Get "heading_title" from language file
		$data['heading_title'] = $this->language->get('heading_title');
		
		// All the necessary page elements
		$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');
		
		// Load the template file and show output
		$this->response->setOutput($this->load->view('information/guarantee', $data));
	}
}
template/information/guarantee.twig
{{ header }}
<div id="information-information" 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 }}
      <h1>{{ heading_title }}</h1>
rwerwrewer	  
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>
{{ footer }}
  • Вопрос задан
  • 22 просмотра
Пригласить эксперта
Ответы на вопрос 1
politon
@politon
HTML5,CSS3,JS,PHP,SQL,API,canvas,animation...
Перенесите файл или измените путь, хз что у вас.
catalog/controller/guarantee.php
в
catalog/controller/information/guarantee.php
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы