I'm new to stackoverflow (it's my first post), and new to Symfony2 and SonataAdmin (a bundle) too, and I have a little problem (I searched, but I cant find a working solution..).
I've created a few entities and they all appear on the left of the dashboard, in the menu, and this is working fine.
But what I want to do is add tabs without creating entity, and when you click on this menu tab, only the content of the right to be changed ! Is that possible? Thank you
Create an empty template in the Resources/views directory of your own admin bundle
(e.g. custom_layout.html.twig).
Then, in your app/config open config.yml (or sonata/admin.yml if you have separated config files for sonata) and add (or update if exists) the following :
sonata_admin:
# ...
templates:
layout: YourBundle::custom_layout.html.twig
Last, open the empty template, make it extending from the standard_layout.html.twig,
override the good block,
and add your custom menu (copy the markup of an existing) :
{% extends 'SonataAdminBundle::standard_layout.html.twig' %}
{% block side_bar_after_nav %}
<li class="treeview">
<a href="#">
<i class="fa fa-folder"></i>
<span>Custom Menu</span>
<i class="fa pull-right fa-angle-left"></i>
</a>
<ul class="treeview-menu">
<li class="first last">
<a href="{{ path('custom_route') }}">
<i class="fa fa-angle-double-right"></i>
Custom link
</a>
</li>
</ul>
</li>
{% endblock %}
That's all.
Related
I am working on a wordpress site that is working with the woocommerce plugin.
This is what I am having trouble with:
IN SHORT:
In the main products page, the product description is part of the anchor and is therefore clickable. I would like to limit the anchor to only the product name.
How can I achieve this?
DETAILS:
The woocommerce product page is structured as follows:
<ul class="products">
<li class=MULTIPLE_CLASSES>
<a href="LINK_TO_PRODUCT_PAGE">
<img class="" etc.....>
<h3>PRODUCT_NAME</h3>
<div itemprop="description">
<p></p>
</div>
<span class="price">
<span class="amount">COST_OF_PRODUCT</span>
</span>
</a>
<a class="button etc..."</a>
</li>
</ul>
As such, the anchor is applied to all the product's information, including the description and the price.
I don't really like this functionality and also, as such, the user can't select the text. So I would like the anchor to surround only the product name.
I guess the output I want is something like this:
<ul class="products">
<li class=MULTIPLE_CLASSES>
<a href="LINK_TO_PRODUCT_PAGE">
<img class="".....>
<h3>PRODUCT_NAME</h3>
</a>
<div itemprop="description">
<p></p>
</div>
<span class="price">
<span class="amount">COST_OF_PRODUCT</span>
</span>
<a class="button ...."</a>
</li>
</ul>
So far, I tried as follows:
Researched on the web to see how to customize woocommerce pages. What I found was to duplicate the file you want to change and put it in the child-theme/woocommerce folder. However, that applies only to the files in the templates folder, but this file seems to be not in the templates folder but rather in the includes/admin/views folder
The reason why I italicized the word 'seems' is because I changed that core file manually and replaced it, but it does not take effect! On the site, the structure is still as always! So maybe this is not the file?!
Any help will be greatly appreciated.
Thanks in advance
P.S. I know how to code in many languages, but I never got to PHP. So, if this involves PHP, I would appreciate some guidance.
I'm working on the admin of my portfolio and I'm having a dilemma about my menu. The admin side of my portfolio allows me to change some general info, add, modify or delete a project. Therefore, all pages of my admin have the same menu. The menu have the following buttons: a button to change the general info and a button to add a new project. if there are projects in the database, the menu have more things, a select with the names of my projects and the two buttons to modify or delete the project.
At first, I made a form for everything about the project and an other just for the change info button, but after asking some question, I got often told that I shoudn't make any form for that and that just making link should be fine.
I like that idea, but, if I do that, how can I pass the selected project when I click on modify for exemple?
<a href="{{ path("modify_project") }}">
Here is my current code:
<ul>
<li>
Ajouter un projet
</li>
</ul>
{% if projets | length > 0%}
<select>
{% for id,projet in projets %}
<option value={{ id }}>{{ projet }}</option>
{% endfor %}
</select>
<ul>
<li>
Modifier
</li>
<li>
Supprimer
</li>
</ul>
{% endif %}
If someone have a better idea, I will be very interested to ear it.
Have you had a look at this: https://github.com/KnpLabs/KnpMenuBundle?
Sorry, your are right, the answer is actually this one:
{{ entity.id }}
Twig will understand that, nothing more to do.
After really thinking about it, The best way would be a form, since you can't change the href of the link, except with javascript and I don't want to do that.
I'm in charge of the administration of website build on Symfony but i'm not very familiar with this framework.
They want me to delete the Deutsch part. My first move was to delete the Deutsch link in the languages dropdown menu.
But even if in the source code the link is now gone, it keeps displaying on the website what am I missing ?
{% trans %}Language{% endtrans %}
<ul class="dropdown-menu pull-right">
<li>English</li>
<li>Français</li>
<li>Italiano</li>
<li>Español</li>
</ul>
Here's the website: http://valessentia.com/fr
I am in the process of setting up the theme for my website using Jekyll.
I am using the Bootstrap example theme for this and I am currently facing an issue where by the Home button stays 'pressed down' when on another page such as the About page.
Here is a link to the CSS file: https://github.com/Dansmithyy/dansmeuktheme/blob/master/css/main.scss
Is there any way of changing this so that the buttons stay pressed down when the user is on that specific page?
Your main menu is hard coded in html. And it remains the same all over your pages.
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
My code inspector tell me that a rule is applied to
.navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.active>a
Here is the origin of the symptom.
The real cause of your problem is that your are hard coding your main menu.
If you look in your original default.html file and then in _includes/header.html you can see things like {% include header.html %} and {% for page in site.pages %}...
The last tag help you automatically generate a menu. I've added the active class trick in it to save you some time :
<ul class="nav navbar-nav">
{% for node in site.pages %}
{% if node.title %}
<li class="{% if page.url == node.url %} active{% endif %}">
{{ node.title }}
</li>
{% endif %}
{% endfor %}
</ul>
NOTE the {% if node.title %} if you want a page to appear in the menu you must put a title variable in the page's front matter. eg: title: My nice title
I don't know if i set my breadcrumbs correctly, all my pages have breadcrumb like so:
<body itemscope="itemscope" itemtype="http://schema.org/WebPage">
<div class="breadcrumb">
<a title="MY Site Title" rel="home" itemprop="breadcrumb" href="http://www.mysite.com/">MY Site Title</a>
<span class="navigation-pipe">»</span>
<a title="Category Name" itemprop="breadcrumb" href="http://www.mysite.com/CategoryName">Category Name</a>
<span class="navigation-pipe">»</span>Product Page
</div>
And if its a Product page i add this to the body after the breadcrumb.
<div itemscope itemtype="http://schema.org/Product">
With Product info HERE
</div>
You should try adding
itemprop="breadcrumb"
to the containing div, not the links themselves. As shown in the correct answer here.
You can also use Google's own structured data testing tool to test what data it is able to extract.
They also have a troubleshooting section which describes common pitfalls.
Finally, if all else fails you can ask them manually though they don't promise an individual response.