Reputation: 3857
I created new controller and new view
<?php
namespace My\ProductBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class ProductController extends Controller
{
/**
* @Route("/GetProducts")
*/
public function GetProductsAction()
{
return $this->render('MyProductBundle:Product:get_products.html.twig', array(
));
}
}
view:
{% extends "::base.html.twig" %}
{% block title %}MyProductBundle:Product:GetProducts{% endblock %}
{% block body %}
<h1>Welcome to the Product:GetProducts page</h1>
{% endblock %}
when try to access this action /GetProducts
I got the following error:
Variable "organization_name" does not exist.
Stack Trace
in vendor\oro\customer-portal\src\Oro\Bundle\FrontendBundle\Resources\views\Organization\logo_frontend.html.twig at line 3 -
{% set route = 'oro_frontend_root' %}
{% if isDesktopVersion() %}
{% if organization_name|length %}
{% set logo = oro_theme_logo() %}
<h1 class="logo logo-{{ logo ? 'image' : 'text' }}">
<a href="{{ path(route) }}" title="{{ organization_name }}">
Upvotes: 0
Views: 298
Reputation: 46
Ayman Hussein.
You should extend more specific template than ::base.html.twig
.
For example, your view can looks like
{% extends 'OroFrontendBundle:actions:view.html.twig' %}
{% block title %}MyProductBundle:Product:GetProducts{% endblock %}
{% block body %}
<h1>Welcome to the Product:GetProducts page</h1>
{% endblock %}
Upvotes: 1
Reputation: 737
before {% if organization_name|length %}
add another condition to check if the var is already defined or not: {% if organization_name is defined %}
Upvotes: 0