Last active
August 29, 2015 13:56
-
-
Save BriceShatzer/9215508 to your computer and use it in GitHub Desktop.
Unlimited item list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<body> | |
<!-- module key -- | |
{module_webapps,16526,a,,,,,4 template="/layouts/webapps/data_model_templates/buildHTML_mediaList.tpl"} | |
builds a list of web app items using the following template | |
<a class="mediaItem" data-showID="{tag_show_id}" data-imageURL="{tag_image file_value}" data-videoURL="{tag_video link}">{tag_caption}</a> | |
if the list paginates at a certain point (set to 4 items for testing purposes) at which point pageination is automatically added to the bottom of the list | |
{module_webappscount,16526} | |
spits out the total number of web app items | |
--> | |
{module_webapps,16526,a,,,,,4 template="/layouts/webapps/data_model_templates/buildHTML_mediaList.tpl"} | |
</body> | |
<script> | |
var paginationCount = Math.ceil({module_webappscount,16526} / 4) | |
if (paginationCount>1){ | |
var loadURL = $('li.pag-number a').first().attr('href'); | |
loadURL = loadURL.substring( 0, loadURL.lastIndexOf('Page=')+5 ); | |
for (var i = 2; i<=paginationCount; i++) | |
{ $('body').append( $('<div></div>').load(loadURL+i+' a.mediaItem') )} | |
} | |
$('ul.pagination.webapp').remove(); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set up as an independent page that uses no template. It can be loaded in using | |
$.ajax({ | |
url: "itemList.html", | |
success: function (data) { | |
//do what ever you want with the data | |
}, | |
dataType: 'html' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment