Esempio n. 1
0
 public function sitmap()
 {
     $this->load->library('Sitemap');
     // 基礎設定
     $domain = 'http://www.zeusdesign.com.tw';
     $sit_map = new Sitemap($domain);
     $sit_map->setPath(FCPATH . 'sitemap' . DIRECTORY_SEPARATOR);
     $sit_map->setDomain($domain);
     // main pages
     $sit_map->addItem('/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/abouts/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/contacts/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/works/', '0.8', 'daily', date('c'));
     $sit_map->addItem('/articles/', '0.8', 'daily', date('c'));
     // all articles
     foreach (Article::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_visibled = ? AND destroy_user_id IS NULL', Article::IS_VISIBLED))) as $article) {
         $sit_map->addItem('/article/' . $article->site_show_page_last_uri(), '1', 'daily', $article->updated_at->format('c'));
     }
     // all article tags
     foreach (ArticleTag::all(array('select' => 'id')) as $tag) {
         $sit_map->addItem('/article-tag/' . $tag->id . '/articles/', '0.8', 'daily', date('c'));
     }
     // all works
     foreach (Work::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_enabled = ? AND destroy_user_id IS NULL', Work::ENABLE_YES))) as $work) {
         $sit_map->addItem('/work/' . $work->site_show_page_last_uri(), '1', 'daily', $work->updated_at->format('c'));
     }
     // all work tags
     foreach (WorkTag::all(array('select' => 'id')) as $tag) {
         $sit_map->addItem('/work-tag/' . $tag->id . '/works/', '0.8', 'daily', date('c'));
     }
     $sit_map->createSitemapIndex($domain . '/sitemap/', date('c'));
 }
Esempio n. 2
0
' placeholder='請輸入標題..' maxlength='200' pattern='.{1,200}' required title='輸入標題!' autofocus />
        </td>
      </tr>

      <tr>
        <th>封 面:</th>
        <td>
          <?php 
echo (string) $article->cover ? img($article->cover->url('100x100c'), false, 'class="cover"') : '';
?>
          <input type='file' name='cover' value='' />
        </td>
      </tr>

<?php 
if ($tags = ArticleTag::all()) {
    ?>
        <tr>
          <th>標 籤:</th>
          <td>
      <?php 
    $tag_ids = isset($posts['tag_ids']) ? $posts['tag_ids'] : column_array($article->mappings, 'article_tag_id');
    foreach ($tags as $tag) {
        ?>
              <label><input type='checkbox' name='tag_ids[]' value='<?php 
        echo $tag->id;
        ?>
'<?php 
        echo $tag_ids && in_array($tag->id, $tag_ids) ? ' checked' : '';
        ?>
/><div><?php 
 public function tags()
 {
     $tags = ArticleTag::all(array('order' => 'RAND()'));
     return $this->setUseCssList(true)->load_view(array('tags' => $tags));
 }