Skip to content

Instantly share code, notes, and snippets.

@shannah
Created May 28, 2014 16:25
Show Gist options
  • Save shannah/63308af2ae12c6e7e2fe to your computer and use it in GitHub Desktop.
Save shannah/63308af2ae12c6e7e2fe to your computer and use it in GitHub Desktop.
Xataface home action
<?php
class actions_home {
function handle(&$params){
// Get the featured items
$indexItems = df_get_records_array('featured', array('active'=>1, '-sort'=>'effectiveDate desc'));
$ii = array();
foreach ($indexItems as $item){
$ii[] = $item->strvals();
unset($item);
}
unset($indexItems);
import('Services/JSON.php');
$json = new Services_JSON;
$jsonIndexItems = $json->encode($ii);
//echo $jsonIndexItems;
// Get the featured items
$spotlightItems = df_get_records_array('spotlight', array('active'=>1), null, null, false);
$spotlight = array();
foreach ($spotlightItems as $item){
$spotlight[] = $item->strvals();
unset($item);
}
unset($spotlightItems);
//import('Services/JSON.php');
//$json = new Services_JSON;
$jsonSpotlightItems = $json->encode($spotlight);
//echo $jsonIndexItems;
// Get the news
//$res = mysql_query("select topic_id, topic_title from phpbb_topics where forum_id=8 order by topic_time desc limit 5", df_db());
$res = df_get_records_array('phpbb_topics', array('-sort'=>'topic_time desc', 'forum_id'=>8, '-limit'=>5));
$news = array();
foreach ($res as $row ) $news[] = $row->strvals();
unset($res);
//@mysql_free_result($res);
// Get the forum posts
//$res = mysql_query("select topic_id, topic_title from phpbb_topics where forum_id=8 order by topic_time desc limit 5", df_db());
$res = df_get_records_array('phpbb_topics', array('-sort'=>'topic_time desc', 'forum_id'=>'!=8', '-limit'=>5));
$posts = array();
foreach ($res as $row ) $posts[] = $row->strvals();
unset($res);
// Get the freshmeat ratings
$dataface =& df_get_record('products', array('product_id'=>5));
// Get weblogs
$blogs = df_get_records_array('news', array('status'=>'Approved', 'categories'=>'2 OR 3 OR 4 OR 5', '-sort'=>'date_posted desc', '-limit'=>5));
// Get application categories
$product_cats = df_get_records_array('product_categories', array('-limit'=>3));
df_display(array(
'indexItems'=> $jsonIndexItems,
'spotlightItems'=>$jsonSpotlightItems,
'news' => $news,
'posts' => $posts,
'xataface_product' => $dataface,
'blogs' => $blogs,
'product_categories'=>$product_cats
),
'home_alt.html'
);
}
}
{use_macro file="Dataface_Main_Template.html"}
{fill_slot name="head_slot"}
<meta name="keywords" content="php,mysql,framework,filemaker alternative, fmp alternative,rapid development,crud,editable grid,library,xataface,dataface,database application,mysql app,database front-end,mysql front-end,website back-end,code generator,php code generation,SQL,MySQL administrator,PHPMyAdmin,open source php framework,GPL" />
<meta name="description" content="Xataface is an open source PHP framework for building PHP/MySQL applications in less time that with fewer lines of code that do more."/>
<script language="javascript" type="text/javascript" src="{$ENV.DATAFACE_SITE_URL}/js/home_alt.js"></script>
{literal}
<style type="text/css"><!--
table#north_cell-table {
background-image: url(images/table-bg.jpg);
background-repeat: repeat-x;
}
td#left_column {
display: none;
}
td.subjectBlock {
padding-right: 10px;
border: 1px solid #8cacbb;
padding-left: 100px;
height: 150px;
background-repeat: no-repeat;
vertical-align: top;
}
td.less-padding {
padding-left: 25px;
padding-right: 25px;
}
td.subjectBlock li {
list-style-type:none;
}
td.ne_cell {
vertical-align: top;
}
td.ne_cell ul li,
td.subjectBlock ul li {
list-style-type: none;
list-style-image: none;
}
td.ne_cell ul,
td.subjectBlock ul {
margin: 0;
padding: 0;
}
td.ne_cell ul li a{
border-bottom: 1px solid #dee7ec;
display: block;
text-decoration: none;
padding-left: 80px;
background-repeat: no-repeat;
}
td.ne_cell ul li a:hover {
background-image: url(images/table-bg.jpg);
border-bottom: 2px solid #8cacbb;
}
.newslist li {
list-style-type: none;
list-style-image:none;
}
.blog-posted-by {
color: gray;
font-size: 90%;
text-align: right;
padding-left: 2em;
}
.blog-more-from-blog {
text-align: right;
font-size: 90%;
}
td#spotlight-item h4 {
padding-bottom: 10px;
}
td#spotlight-item div.spotlight-content {
padding: 5px;
line-height: 2em !important;
}
--></style>
{/literal}
{/fill_slot}
{fill_slot name="main_section"}
<div id="north_cell">
<table width="100%" id="north_cell-table">
<tr>
<td width="590" id="featured-item" style="height: 300px; background-repeat: no-repeat; background-image:url(http://dev.weblite.ca/phpimageserver/photos/xataface.com/feature-banner.png)">
<div style="display:none">
<h3>Build powerful user interfaces for your database in minutes</h3>
<p>Open source, PHP, GPL, MySQL</p>
</div>
</td>
<td class="ne_cell">
<ul>
<li><a href="/wiki/about" style="background-image:url(http://upload.wikimedia.org/wikipedia/en/thumb/3/35/Information_icon.svg/62px-Information_icon.svg.png)">
<h3>About Xataface</h3>
<p>What can Xataface do for you?</p>
</a>
</li>
<li><a href="/videos" style="background-image:url(images/watch.png)">
<h3>Watch Xataface in Action</h3>
<p>Click here to watch videos that demonstrate Xataface in action.</p>
</a>
</li>
<li><a href="https://sourceforge.net/projects/dataface/files/xataface/xataface-2.0.3/" style="background-image:url(images/download.png)">
<h3>Download the latest version</h3>
<p>Xataface 2.0.3</p>
</a>
</li>
</ul>
</td>
</tr>
</table>
</div>
<script language="javascript"><!--
//var featured = new XatafaceNews({$indexItems});
//setInterval('featured.next()', 5000);
//--></script>
<div id="south_cell">
<table width="100%">
<tr>
<td width="33%" valign="top" class="subjectBlock" align="right" style="background-image: url(http://dev.weblite.ca/phpimageserver/photos/xataface.com/iStock_000004009404XSmall.jpg?max_width=100&filter:gaussian_blur=1);">
<h3><a href="/documentation">Documentation</a></h3>
<li><a href="/videos#introduction.flv">Video Quickstart Tutorial</a></li>
<li><a href="/documentation/tutorial/getting_started">Getting Started Tutorial</a></li>
<li><a href="/assets/dataface/about/presentations/Introduction_to_Dataface.pdf">Building Data-centric Websites with Dataface</a> (PDF)</li>
<li><a href="/documentation">More...</a></li>
</td>
<td width="33%" class="subjectBlock" align="right" style="background-image: url(http://dev.weblite.ca/phpimageserver/photos/xataface.com/megaphone.png);">
<h3><a href="forum/viewforum.php?f=8">News</a> <a href="http://xataface.com/admin.php?-table=phpbb_posts&-action=feed&--format=RSS2.0&forum_id=8" title="Subscribe to RSS News Feed"><img src="http://xataface.com/df/images/feed-icon-14x14.png" alt="RSS" /></a></h3>
<div class="newslist">
{foreach from=$news item=newsitem}
<li><a href="forum/viewtopic.php?t={$newsitem.topic_id}">{$newsitem.topic_title|escape}</a></li>
{/foreach}
</div>
</td>
<td width="33%" class="subjectBlock" align="right" style="background-image: url(http://dev.weblite.ca/phpimageserver/photos/xataface.com/iStock_000004471239XSmall.jpg?max_width=120&filter:gaussian_blur=1);">
<h3><a href="forum">Community</a>
</h3>
<p>Sign up for weekly newsletter. Enter your email address:
{literal}<form action="admin.php" method="post" onsubmit="if (!this.email.value.match(/^[a-z0-9A-Z.\-_]+@[a-z0-9A-Z.\-]+$/)){alert('Please enter a valid email address.');return false;} return true;">{/literal}
<input type="hidden" name="-action" value="maillist_signup"/>
<input type="text" name="email" size="20" />
<input type="submit" value="Sign up" />
</form>
</p>
<p><a href="http://www.twitter.com/xataface">Twitter Feed</a></p>
<p><a href="http://www.youtube.com/channel/UCEUW1dkQn-q3IL6W5c5LV9g">Youtube Channel</a></p>
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="50%" valign="top" class="subjectBlock less-padding">
<h3><a href="http://xataface-tips.blogspot.com/">Blog</a> <a href="http://xataface-tips.blogspot.com/feeds/posts/default" title="RSS News Feed for Forums"><img src="http://xataface.com/df/images/feed-icon-14x14.png" alt="RSS" /></a></h3>
<script type='text/javascript' charset='utf-8' src='http://scripts.hashemian.com/jss/feed.js?print=yes&numlinks=10&summarylen=100&seedate=yes&popwin=no&url=http:%2F%2Fxataface-tips.blogspot.com%2Ffeeds%2Fposts%2Fdefault'></script>
</td>
<td width="50%" valign="top" class="subjectBlock less-padding" id="spotlight-item">
<h3>Spotlight</h3>
<script language="javascript"><!--
var spotlight = new XatafaceSpotlight({$spotlightItems}, 'spotlight-item');
setInterval('spotlight.next()', 10000);
//--></script>
</td>
</tr>
</table>
</div>
<div id="middle_cell">
<table width="100%">
<tr>
<td></td>
<td><a href="http://sourceforge.net/projects/dataface">Sourceforge Project</a></td>
<td></td>
</tr>
</table>
</div>
{/fill_slot}
{/use_macro}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment