This is my directory structure:
doc/
├─ image.png
src/
README.md
I'm trying to center and resize a logo image on the top of the README file, just like I'm used to do on GitHub (using HTML tags), but I just can't make it work on Azure's Repos.
So far, this is what I tried:
<p align="center">
<a target="blank"><img src="doc/image.png" width="30%" /></a>
</p>
<center>
![image.png](doc/image.png)
</center>
And some other variations of those... I've found some answers on the internet, but none of them seems to work to me.
I'm using opencart 3.0.2 and when i change twig files it doesn't appear on site for example there is a code like this:
<div class="compare">
<button type="button" title="{{ button_compare }}" onclick="compare.add('{{ product.product_id }}');"<span>{{ button_compare }}</span></button>
</div>
and I delete this code from file but it doesn't make any change on the site.
I have a directory called "features" in the root and inside this directory has image "state_transitation.JPG" and document "myMdc_features.md"
I am trying to add an image "state_transitation.JPG" to the md extension document "myMdc_features.md" in my repository by using markdown below:
![alt text](./state_transitation.JPG)
![alt text](/state_transitation.JPG)
![alt text](state_transitation.JPG)
<p>
<img src="state_transitation.JPG" />
</p>
I tried all above options but this is giving page could not be found error. 404
Both myMdc_features.md and image file are in same path/directory.
What is the correct way to display an image in gitlab myMdc_features.md?
I think that the first option should work, assuming they are in the same folder. I made an example repostiory here that works.
Source of the file:
Hello World
![](./i-have-no-idea-what-im-doing.jpg)
Output in GitLab:
I'm new to twig. I'm using it in PhpStorm and have problem with paths.
Here is my folder structure:
- template /folder/
- main.twig
- common /folder/
- bootstrap.twig
- nav.twig
In main.twig I have code:
{% extends "common/bootstrap.twig" %}
When I Ctrl + Click on link PhpStorm opens correct file.
But in bootstrap.twig I have to write:
{% include "common/nav.twig" %}
and then Ctrl + Click is not working.
I cannot use relative paths like nav.twig or ./nav.twig - twig throws error.
How can I make twig to use relative paths so go to source would work in PhpStorm?
Mark your template root folder (template in your case) as Resource Root (either via right click in Project View or via Settings/Preferences | Directories).
https://www.jetbrains.com/help/phpstorm/2016.2/configuring-folders-within-a-content-root.html?search=directories
Files under a folder marked as Resource Root can be referenced relative to this folder.
Is it possible to include a template with {% include %} which is outside from the template path defined with:
$template = $twig->loadTemplate('example.tpl');
I'm asking it because this line doesn't work:
{% include '.../example/navbar_left.tpl' %}
No, it's not possible using Twig_Loader_Filesystem, because it explicitly rejects template names which have .. inside. This can be verified into the definition of function validateName($name) inside file Twig/lib/Twig/Loader/Filesystem.php.
The only clean solution I can think of, if you need to access a template outside the path, is to create your own loader.
A workaround that does work, is defining a symbolic link inside the folder actually registered with Twig_Loader_Filesystem, pointing to the directory you want to access. Be careful with this method, point the link to a safe place.
You can add more paths by following :
https://symfony.com/doc/3.4/templating/namespaced_paths.html
config.yml
# Twig Configuration
twig:
paths:
'%kernel.root_dir%/../src/AppBundle/Resources/views': AppBundle
'%kernel.root_dir%/../web/': 'WEB_DIR_DIST' #your new custom path
someFile.html.twig
<script>{{ source('#WEB_DIR_DIST' ~ 'custom.js') }}</script>
You can add your path to the Twig loader (Filesystem loader)
see last reply from Fabien (addPath method is what you need)
https://github.com/symfony/symfony/issues/1912
you can add the second path to your twig.yaml (symfony 4.4)
twig:
paths:
- '%kernel.project_dir%/templates'
- '%kernel.project_dir%/example'
Then just use the name {% include 'navbar_left.tpl' %}
It is possible through symlink.
Example for Symfony3
from src/AppBundle/Resources/views/Admin
Ubuntu:
ln -s ./../../../../../web/admin/_index-import-body.html index-import-body.html.twig
Windows:
mklink index-import-body.html.twig ./../../../../../web/admin/_index-import-body.html
Then like always include that index-import-body.html.twig in twig file
{% include '#App/Admin/index-import-body.html.twig' %}