Created
June 24, 2013 16:32
-
-
Save jongamble/5851423 to your computer and use it in GitHub Desktop.
A small jquery mobile file I created to pull down the ten most recent blog posts and display them on a main index page, and subpages for each of the blog posts. Pulled it down using an RSS and jQuery.load() method.
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
<?php include('../library/includes/config.php'); ?> | |
<?php | |
$blogUrl = 'http://www.trimarksolutions.com/inside/feed/'; | |
$blogData = simplexml_load_file($blogUrl); | |
$blogData = $blogData->channel; | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Trimark Solutions</title> | |
<?php include('../library/includes/html-head.php'); ?> | |
</head> | |
<body class="blog-page"> | |
<div data-role="page" data-theme="a" id="index"> | |
<?php include('../library/includes/panel.php'); ?> | |
<?php include('../library/includes/header.php'); ?> | |
<div data-role="content" data-theme="a"> | |
<h3><?=$blogData->title?></h3> | |
<p><?=$blogData->description?></p> | |
<ul class="links" data-role="listview" data-inset="true"> | |
</ul> | |
</div> | |
<div data-role="footer" data-position="inline"> | |
<?php include('../library/includes/footer.php'); ?> | |
</div> | |
</div> | |
<?php | |
$i = 0; | |
foreach($blogData->item as $entry){ | |
$i++; | |
?> | |
<div id="item-<?=$i?>" data-role="page" data-theme="a" class="blog-page"> | |
<?php include('../library/includes/panel.php'); ?> | |
<?php include('../library/includes/header.php'); ?> | |
<div data-role="content" data-theme="a"> | |
<h1><?=$entry->title?></h1> | |
<a href="#index" data-role="button" data-icon="arrow-left" data-icon-position="left" data-transition="slide" data-direction="reverse">Back to Blog Home</a> | |
<p class="Data"></p> | |
<a href="#index" data-role="button" data-icon="arrow-left" data-icon-position="left" data-transition="slide" data-direction="reverse">Back to Blog Home</a> | |
<script type="text/javascript"> | |
/* | |
function doSomethingWithData(data) { | |
data = $(data).remove('#header-container').remove('#header').remove('#primary').remove('#secondary').remove('#nav-above').remove('#nav-below').remove('#comments').remove('#footer').remove('#footer-container'); | |
$('#item-<?=$i?> .Data').html(data); | |
} | |
$.get('<?=$entry->link?>', doSomethingWithData, 'json'); | |
*/ | |
$('#item-<?=$i?> .Data').load('<?=$entry->link?> .post .entry-content', function(){ | |
$('.entry-content img').remove(); | |
$('.entry-content iframe').remove(); | |
}); | |
$('#index .links').add('<li data-icon="chevron-right"><a href="#item-<?=$i?>" data-transition="slide" data-msgtext="Loading Blog Post"><?=$entry->title?></a></li>').appendTo('#index .links'); | |
</script> | |
</div> | |
<div data-role="footer" data-position="inline"> | |
<?php include('../library/includes/footer.php'); ?> | |
</div> | |
</div> | |
<?php } ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment