[Install configuration] Can I change basic template ?

Questions around the Aimeos bundle for the Symfony framework
Forum rules
Always add your Symfony, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
ksicinski
Posts: 9
Joined: 05 Jul 2017, 07:18

[Install configuration] Can I change basic template ?

Post by ksicinski » 05 Jul 2017, 07:26

In manual i found this page:
https://aimeos.org/docs/Symfony/Adapt_base_template

But I need change base.html.twig to another file for example base-shop.html.twig because in base.html.twig I have my page configuration.

Can I change this with some parameters in yml? Or meybe is some another way to this?

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: [Install configuration] Can I change basic template ?

Post by aimeos » 05 Jul 2017, 07:58

In Symfony you can overwrite any template from a bundle:
http://symfony.com/doc/current/templati ... iding.html

You only need to overwrite this template and extend from "base-shop.html.twig":
https://github.com/aimeos/aimeos-symfon ... .html.twig
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ksicinski
Posts: 9
Joined: 05 Jul 2017, 07:18

Re: [Install configuration] Can I change basic template ?

Post by ksicinski » 10 Jul 2017, 19:59

This was help.
I made override and it is work.

Tips for other people:

Create new file in:
app/Resources/views/base-shop.html.twig

Code: Select all

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {% block aimeos_header %}{% endblock %}
    <title>{% block title %}Aimeos shop{% endblock %}</title>
    <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
    {% block aimeos_styles %}{% endblock %}
</head>
<body>
<div class="navbar navbar-static" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
    </div>
    {% block aimeos_head %}{% endblock %}
</div>
<div class="col-xs-12">
    {% block aimeos_nav %}{% endblock %}
    {% block aimeos_stage %}{% endblock %}
    {% block aimeos_body %}{% endblock %}
    {% block aimeos_aside %}{% endblock %}
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
{% block aimeos_scripts %}{% endblock %}
</body>
</html>
Create new file in:
app/Resources/AimeosShopBundle/views/base.html.twig
put there this code:

Code: Select all

{% extends 'base-shop.html.twig' %}

 {% block aimeos_styles %}
    <link type="text/css" rel="stylesheet" href="/bundles/aimeosshop/themes/elegance/common.css" />
    <link type="text/css" rel="stylesheet" href="/bundles/aimeosshop/themes/elegance/aimeos.css" />
 {% endblock %}

 {% block aimeos_scripts %}
    <script type="text/javascript" src="/bundles/aimeosshop/themes/jquery-ui.custom.min.js"></script>
    <script type="text/javascript" src="/bundles/aimeosshop/themes/aimeos.js"></script>
    <script type="text/javascript" src="/bundles/aimeosshop/themes/elegance/aimeos.js"></script>
 {% endblock %}
Now you have own basic script.

Post Reply