Jump to content

Modify default Previous/Next page in templates


Recommended Posts

The default previous/next page stuff in WHMCS is ugly. Here is a simple fix.

 

Create a new file called pagenav.tpl and place it somewhere. Add this:

 

<ol class="clearfix">
		{if $prevpage}
			<li class="page-previous">
				<a href="/whmcs/clientarea.php?action={$action}&page={$prevpage}"><</a>
			</li>
		{/if}
		{section name=pages loop=$totalpages}
			{if $smarty.section.pages.iteration == $pagenumber}
				<li class="current page-{$smarty.section.pages.iteration}">
					{$smarty.section.pages.iteration}
				</li>
			{else}
				<li class="page-{$smarty.section.pages.iteration}">
					<a href="/whmcs/clientarea.php?action={$action}&page={$smarty.section.pages.iteration}">
						{$smarty.section.pages.iteration}
					</a>
				</li>
			{/if}
		{/section}
		{if $nextpage}
			<li class="page-previous">
				<a href="/whmcs/clientarea.php?action={$action}&page={$nextpage}">></a>
			</li>
		{/if}
	</ol>

 

Now delete the previous/next table from your templates and add this:

 

{assign var="action" value="emails"}
include file="`$smarty.const.BASE_DIR`/templates/code/pagenav.tpl"}

 

(change action and directories as needed).

 

It will produce something like this:

< 1 2 3 4 5 >

 

Much nicer than just previous/next.

 

Style to your hearts content. The current page LI has a class of current and each page as a class page-#.

 

-David

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated