Announcement

Collapse
No announcement yet.

multiple 'pages' within a section

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    multiple 'pages' within a section

    I've knocked up another quick and dirty fix. In this case, the client wanted to be able to break sections up into pages. I considered the previous/next section hack, but this wasn't appropriate. It wasn't important whether or not the products were loaded all at once, just that the client didn't want to view them all at once and have to scroll down them all.

    So I've built a CSS/javascript fix that I thought I ought to share:
    • Create a variable within the library called 'PageLength'. This represents the number of items per page. Do not allow an empty value. Set the place of setting to 'site'
    • Within the product layout, apply an ID of 'listindex' to the containing element
    • Within the product list, inside the 'start of list section' include the following:
      Code:
      	Pages: 
      	<script>
      	pages = <actinic:variable name="ListCount" />/<actinic:variable name="PageLength" />;
      	pagecount = Math.floor(pages)+(Math.ceil(pages)-Math.floor(pages));
      	for (i=1;i<=pagecount;i++) 
      		{
      		links="&nbsp;&nbsp;&nbsp;<a href=\"javascript:showpage("+i+","+<actinic:variable name="ListCount" />+")\">"+i+"</a> ";
      		document.write(links);
      		}
      	</script>
    • Wherever you keep your javascript code, add the following:
      Code:
      	function showpage(page,itemcount) {
      		for (i=1;i<=itemcount;i++)
      			{
      				if(document.getElementById(i))
      				{document.getElementById(i).style.display = 'none';}
      			}
      		var top=page*<actinic:variable name="PageLength" />;
      		var bottom=top-(<actinic:variable name="PageLength" />-1);
      		for (i=bottom;i<=top;i++)
      		if(document.getElementById(i)) 
      			{
      				{document.getElementById(i).style.display = '';}}
      			}
    • add "showpage(1,9999)" to the onload event of the page to force it to show only the first page.


    This should generate page links like "Pages 1 2 3 4" etc, and hide and show the relevant 'pages' using css. It allows the user to change the number of products shown per page.
    Last edited by IanSaunders; 29-Oct-2009, 04:47 PM. Reason: missed a step

    #2
    multiple pages within a section

    I believe that you want to control in which page the modules will show. This is possible in the Module Manager. When you open a module in the Module Manager on the lower left corner there is a place for menu assignment. You can set in which menus pages the module has to show.
    _______________________________________
    Website I designed for payday loans for canadians company.

    Comment

    Working...
    X