Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript"><!--
google_ad_client = "pub-9994288170196423";
/* 728x90, created 1/6/09 */
google_ad_slot = "6863598004";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
#adds asset fields to appropriate forms
sub add_asset_fields{
my ($cb, $app, $param, $tmpl) = @_;
my $asset = $param->{asset};
#$asset->init_meta();
if($asset){
$tmpl->context->var('credit_url', $asset->credit_url);
$tmpl->context->var('credit_text', $asset->credit_text);
$tmpl->context->var('caption', $asset->caption);
}
<?
require_once('/home/kurt/ars-technica-mt-bits/published/includes_c/classes.inc.php');
$_instance = new Entry();
$_instance->body = 'Clint is cool
[What now!](http://google.com)
Blah blah blah';
$_instance->excerpt = 'Clint is cool [What now!](http://google.com) Blah blah blah...';
<?
require_once('/home/kurt/ars-technica-mt-bits/published/includes_c/classes.inc.php');
$_resource = new Entry();
$_resource->excerpt = 'Clint is cool [What now!](http://google.com) Blah blah blah...';
$_resource->listing_image = false;
$_resource->listing_image = new Image();
$_resource->listing_image->caption = '';
$_resource->listing_image->credit = '';
<?
require_once('/home/kurt/ars-technica-mt-bits/published/includes_c/classes.inc.php');
$_resource = new Category();
$_resource->entries = array('http://kurt.staging.arstechnica.com/published/2009/01/asdf.php', 'http://kurt.staging.arstechnica.com/published/2009/01/i-am-testing-stuff-here8.php', 'http://kurt.staging.arstechnica.com/published/2009/01/this-is-a-test-of-the-blah-blah-blah-system.php', 'http://kurt.staging.arstechnica.com/published/2007/08/two-more-iphone-ads-all-these-years-and-all-the-parts.php');//Category
$_resource->name = 'apple';
$_resource->children = array(
'http://kurt.staging.arstechnica.com/published/apple/guides/', 'http://kurt.staging.arstechnica.com/published/apple/news/', 'http://kurt.staging.arstechnica.com/published/apple/reviews/', 'http://kurt.staging.arstechnica.com/published/apple/iphone/', 'http://kurt.staging.arstechnica.com/published/apple/mwsf/',
<h1><?= $category->name ?></h1>
<? if($category->archives){ ?>
<h4>Archives:</h4>
<ul>
<? foreach($category->archives->load() as $archive){ ?>
<li><a href="<?= $archive->url ?>"><?= category_title($archive) ?></a></li>
<? } ?>
</ul>
<? } ?>
<? if($category->entries){ ?>
class ResourceList extends ArrayObject{
private static $resolver = '';
private $resolved = false;
public static function set_resolver($method){
self::$resolver = explode('::', $method);
}
public function load(){
if($this->resolved !== false) return $this->resolved;
$this->resolved = array();
<?
$cat_type = $GLOBALS['resource']->is_parent_of($entry) ? 'primary' : 'secondary';
$page_count = count($entry->pages);
$multipage = ($page_count > 1);
$has_extended_body = ($page_count > 0);
?>
<div class="journal-item <?= $cat_type ?> opened">
<h3 class="journal-title">
<? if($cat_type == 'secondary'){ ?><a href="#" class="disclosure collapse">&nbsp;</a><? } ?>
<a href="<?= $entry->url ?>" name="<?= $entry->id ?>" class="<?= $multipage ? "multipage" : "onepage" ?> article-headline"><?= $entry->title ?>
<? $render->open_layout('standard'); ?>
<? $GLOBALS['category'] = $category; ?>
<h1><?= $category->name ?></h1>
<? if($category->archives){ ?>
<h4>Archives:</h4>
<ul>
<? foreach($category->archives->load() as $archive){ ?>
<li><a href="<?= $archive->url ?>"><?= $render->title($archive) ?></a></li>
<? } ?>
</ul>
<?
class render{
var $set;
public static function template($set, $data){
$tmpl = render::_get_template_for_resource($set, $data);
$render = new render();
$render->set = $set;
render::_template($render, $tmpl, $data);