Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Changing Pagination Language


Go to End


3 Posts   1676 Views

Avatar
alialamshahi

Community Member, 5 Posts

11 October 2015 at 8:39pm

Edited: 11/10/2015 8:40pm

Hello everyone, I'm building a Farsi (Persian) website, in search results pagination, I get English numbers but I want them to be Persian numbers (۱ ۲ ۳ ۴ ۵ instead of 1 2 3 4 5) how can I achieve this?

Thanks in advance

Avatar
helenclarko

Community Member, 166 Posts

12 October 2015 at 9:39am

Hi Alialamshahi,

I'm not sure how you would get the numbers to work, as it looks like $PageNum only gives you 1, 2, 3 numbers.

You could change from numbers within the template file for site search, the "Page_resaults.ss" file.
For example, I am not using numbers on my search results page, instead I have decided to use simply "Next" and "Previous".

Here is my "Page_resaults.ss" file for example:

<div id="contentHolder">
	<% include SideBar %>
	
	<div id="content" class="typography">
		<h1>$Title</h1>
		<% if Results %>
			<div id="SearchResults">
			  <% loop Results %>
				<div>
					<% if MenuTitle %>
					  <a class="searchResultHeader" href="$Link" title="Read more about $Title">$MenuTitle</a>
					<% else %>
					  <a class="searchResultHeader" href="$Link" title="Read more about $Title">$Title</a>
					<% end_if %>
				  <% if Content %>
					$Content.FirstParagraph(html)
				  <% end_if %>
				  <div class="clear"></div>
				  <a class="readMoreLink" href="$Link" title="Read more about $Title">Read more</a>
				</div>
				<% if First || Middle %>
					<hr />
				<% end_if %>
			  <% end_loop %>
			</div>
		  <% else %>
			<p class="alert-info">Sorry, your search query did not return any results.</p>
		  <% end_if %>
	
		  <% if Results.MoreThanOnePage %>
			<div class="pagination">
				<ul>
					<% if Results.NotFirstPage %>
						<li><a class="prev" href="$Results.PrevLink" title="View the previous page">Prev</a></li>
					<% end_if %>
					<% loop Results.SummaryPagination(5) %>
						<% if CurrentBool %>
							<li class="active"><a href="$Link" title="View page number $PageNum">$PageNum</a></li>
						<% else %>
							<li><a href="$Link" title="View page number $PageNum">$PageNum</a></li>
						<% end_if %>
					<% end_loop %>
					<% if Results.NotLastPage %>
						<li><a class="next" href="$Results.NextLink" title="View the next page">Next</a></li>
					<% end_if %>
				</ul>
		  
			</div>
		 <% end_if %>
	</div>
</div>

Avatar
alialamshahi

Community Member, 5 Posts

12 October 2015 at 6:20pm

Thanks a million Helenclarko!

We should be able to do this! your solution helps, but I still want to show the total number of pages!

Thanks again