Skip to content

Commit

Permalink
Add slim twig extension information
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansuter committed May 12, 2019
1 parent f8f0b08 commit 00ed5da
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
62 changes: 60 additions & 2 deletions application/templates/home.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
This is a skeleton for a web application that uses the Slim 4 Framework.
</p>

<h2>
<h2 class="mt-4">
PSR-7 implementation
</h2>

Expand All @@ -19,12 +19,70 @@
file. The two packages are <code>nyholm/psr7</code> and <code>nyholm/psr7-server</code>.
</p>

<h2>
<h2 class="mt-4">
Dependency injection
</h2>

<p>
By default this project uses the PHP-DI package to build a <code>Container</code>
for dependency injection.
</p>

<h2 class="mt-4">
Slim Twig extension
</h2>

<div class="table-responsive">
<table class="table table-sm">
<thead>
<tr>
<th scope="col">Code</th>
<th scope="col">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>url_for('hello', {'name': 'foo'})</code>
</td>
<td>
{{ url_for('hello', {'name': 'foo'}) }}
</td>
</tr>
<tr>
<td>
<code>full_url_for('home')</code>
</td>
<td>
{{ full_url_for('home') }}
</td>
</tr>
<tr>
<td>
<code>is_current_url('home')</code>
</td>
<td>
{{ is_current_url('home') ? 'TRUE' : 'FALSE' }}
</td>
</tr>
<tr>
<td>
<code>current_url()</code>
</td>
<td>
{{ current_url() }}
</td>
</tr>
<tr>
<td>
<code>get_uri().scheme</code>
</td>
<td>
{{ get_uri().scheme }}
</td>
</tr>
</tbody>
</table>
</div>

{% endblock %}
2 changes: 1 addition & 1 deletion application/templates/html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item{% if is_current_url('home') %} active{% endif %}">
Expand Down

0 comments on commit 00ed5da

Please sign in to comment.