Search
 
SCRIPT & CODE EXAMPLE
 

HTML

twig pagination bootstrap 5

<nav aria-label="Page navigation example">
		<ul
			class="pagination justify-content-center">
			{# precedent #}
			<li class="page-item {{ app.request.query.get('page')==1 or app.request.query.get('page')==0 ? 'disabled' }} ">
				{% if app.request.query.get('page') is defined and app.request.query.get('page')>1 %}
					{% set precedent = app.request.query.get('page') -1 %}
				{% else %}
					{% set precedent = 1 %}
				{% endif %}
				<a class="page-link" href="{{ path('¤entity¤_index',{'page':precedent,'tri':app.request.query.get('tri'),'ordre':app.request.query.get('ordre')}) }}">
					<span aria-hidden="true">&laquo;</span>
				</a>
			</li>
			{% if pagesMaxi/10>6 %}
				{# 1 #}
				<li class="page-item">
					<a class="page-link" href="{{ path('¤entity¤_index',{'page':1,'tri':app.request.query.get('tri'),'ordre':app.request.query.get('ordre')}) }}">1</a>
				</li>
				{# pages millieu #}
				{% for item in 1..5 %}
					<li class="page-item">
						<a class="page-link " href="{{ path('¤entity¤_index',{'page':(pagesMaxi/10/6*loop.index)|number_format(0),'tri':app.request.query.get('tri'),'ordre':app.request.query.get('ordre')}) }}">{{(pagesMaxi/10/6*loop.index)|number_format(0)}}</a>
					</li>
				{% endfor %}
				{# maxi #}
				<li class="page-item">
					<a class="page-link" href={{ path('¤entity¤_index',{'page':(pagesMaxi/10)|number_format(0),'tri':app.request.query.get('tri'),'ordre':app.request.query.get('ordre')} ) }}>{{(pagesMaxi/10)|number_format(0)}}</a>
				</li>
			{% else %}
				{% for item in 1..(pagesMaxi/10)|number_format(0) %}
					<li class="page-item">
						<a class="page-link " href="{{ path('¤entity¤_index',{'page':loop.index,'tri':app.request.query.get('tri'),'ordre':app.request.query.get('ordre')}) }}">{{loop.index}}</a>
					</li>
				{% endfor %}
			{% endif %}
			{# suivant #}
			<li class="page-item {{ app.request.query.get('page') >= (pagesMaxi/10)|number_format ? 'disabled' }}">
				{% if app.request.query.get('page')==0 %}
					{% set suivant = 2 %}
				{% else %}
					{% set suivant = app.request.query.get('page') +1 %}
				{% endif %}
				<a class="page-link" href="{{ path('¤entity¤_index',{'page':suivant,'tri':app.request.query.get('tri'),'ordre':app.request.query.get('ordre')}) }}">
					<span aria-hidden="true">&raquo;</span>
				</a>
			</li>
		</ul>
	</nav>
Comment

PREVIOUS NEXT
Code Example
Html :: form tab index skip readonly 
Html :: basic steps convert design into html 
Html :: Aria hr role 
Html :: PC JS 
Html :: how to make comments in markdown which do not render in html 
Html :: pre-fill the input with the default domain 
Html :: row span and column span in html example 
Html :: css: how to change SVG color when :hover on Parent element 
Html :: date 
Html :: close button 
Html :: them my login custom dashboard 
Html :: boostrap thymeleaf modal 
Html :: how to set up html basic workspace 
Html :: vuetify html tag lang 
Html :: desactiver un boutton react 
Html :: autoplay controls html5 
Html :: how to switch between read only input in html 
Html :: html cache api checker 
Html :: html page in wordpress 
Html :: how to convert divs to accordians responsively 
Html :: pass parameter and jump to particular section 
Html :: vmware workstation ubuntu 17.10 
Html :: how to do that if src is invalid it wont show error 
Html :: animated dots 
Html :: how to check *ngIf with ENUMs in componenet.html 
Html :: pulsating icons 
Html :: pills vertically with content on right 
Html :: how to add multiple rows inside a row in html 
Html :: html button radio button 
Html :: attach a script to a button html 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =