Skip to content

Instantly share code, notes, and snippets.

@gaker
Created October 28, 2010 21:53
Show Gist options
  • Save gaker/652402 to your computer and use it in GitHub Desktop.
Save gaker/652402 to your computer and use it in GitHub Desktop.
blog post code
<?php
// Gimme the URL helper
$this->EE->load->helper('url');
$this->EE->load->library('typography');
$base_url = $this->EE->config->item('base_url');
/**
* Query
*/
$select = 'ct.site_id, ct.entry_id, ct.channel_id, ct.author_id, ct.title, ct.url_title, ' .
'cd.field_id_1 as summary, cd.field_id_2 as body, cd.field_id_3 as extended, ' .
'm.member_id, m.group_id, m.username, m.screen_name, m.email, m.url, m.location, ' .
'm.interests, m.occupation, m.avatar_filename, m.avatar_width, m.avatar_height';
$q = $this->EE->db->select($select)
->from('channel_titles ct')
->join('channel_data cd', 'cd.entry_id = ct.entry_id')
->join('members m', 'm.member_id = ct.author_id')
->where('ct.site_id', $this->EE->config->item('site_id'))
->order_by('ct.entry_id', 'asc')
->limit(100)
->get();
/**
* DO it, Do it!
*/
foreach ($q->result() as $row): ?>
<h2><a href="entry/<?php echo $row->url_title?>"><?php echo $row->title?></a></h2>
<?php if ($row->avatar_filename): ?>
<a href="<?php echo $row->url?>">
<img src="<?php echo $base_url?>/images/avatars/<?php echo $row->avatar_filename?>">
</a>
<?php endif; ?>
<p>This post is by <?php echo safe_mailto($row->email, $row->screen_name) ?>. This person rules!</p>
<?php echo $this->EE->typography->auto_typography($row->summary)?>
<?php echo $this->EE->typography->auto_typography($row->body)?>
<?php echo $this->EE->typography->auto_typography($row->extended)?>
<hr>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment