[Ask] Static Homepage untuk HTMLy

Discussion in 'HTMLy' started by Fahmi, May 25, 2014.

  1. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Terpikir untuk membuat static homepage jika menggunakan platform HTMLy, jadi begini ; misal Homepage berada pada 1 buah render file anggaplah home.tpl.php dan latest post yang standard nya berada dalam url : hxxp://namablog.com/blog :)

    Apakah ini bisa ? :D

    Oke saya rasa dimulai dari file htmly.php :

    Code:
    get('/blog', function () {
     
  2. nadytkj

    nadytkj Member

    Joined:
    Feb 28, 2014
    Messages:
    23
    Likes Received:
    3
    Trophy Points:
    8
    Mungkin agan" yg dibawah saya yang bisa jawab gan :)
     
  3. Arul

    Arul Member

    Joined:
    Jul 10, 2013
    Messages:
    305
    Likes Received:
    19
    Trophy Points:
    18
    Google+:
    Saya nyimak aja, belum paham beginian :)
     
  4. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Yowis simak baik-baik yah :)
     
  5. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Dulu saya sudah bikin semacam ini jadi nanti dibuat semacam config baru, tapi berhubung karena ini temanya blogging platform akhirnya saja hentikan pengembangan ke arah situ :D
     
  6. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Gpp mas Dan, kalau kayak gini kan pengembangan ada pada pemakai masing-masing :D --- lanjut yaa sepertinya saya sudah bisa nih :

    1. Function Index di arah kan ke home.tpl.php
    Code:
    get('/index', function () {
    ....
    ....
    render('home',array(
    2. Membuat Function baru /blog :)
    Code:
    get('/blog', function () {
    
        $page = from($_GET, 'page');
        $page = $page ? (int)$page : 1;
        $perpage = config('posts.perpage');
      
        $posts = get_posts(null, $page, $perpage);
      
        $total = '';
      
        $tl = blog_tagline();
      
        if($tl){ $tagline = ' - ' . $tl;} else {$tagline = '';}
      
        if(empty($posts) || $page < 1){
      
            // a non-existing page
            render('no-posts',array(
                'head_contents' => head_contents('Blog '.blog_title() . $tagline, blog_description(), site_url().'blog'),
                'bodyclass' => 'noposts blog',
            ));
          
            die;
        }
      
        render('main',array(
            'head_contents' => head_contents('Blog '.blog_title() . $tagline, blog_description(), site_url().'blog'),
            'page' => $page,
            'posts' => $posts,
            'bodyclass' => 'infront blog',
            'breadcrumb' => '',
            'pagination' => has_pagination($total, $perpage, $page)
        ));
    });
    Demo : http://fahmi.defaka.com/

    Seperti mantap banget ini Platform HTMLy :D
     
  7. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Bener seperti itu jadi tinggal copy paste dari yang index :D

    Update: ingat HTMLy itu sangatlah fleksibel sebenarnya cuman harus coding :)
     
  8. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Tinggal memodifikasi breadcrumb sudah jadi itu.
     
  9. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Yup mantap, tadi awalnya kepingin bertanya eh nguprek-nguprek malah bisa sendiri :D dan kalau sudah begini kan HTMLy bisa menurut saya untuk develop situs misal : Creative Corporate huhuhu keren
     
  10. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Update :D sudah dipasangkan breadcrumb nya *bagus*
     
  11. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Oh iya untuk file baru nya yang diberi nama home.tpl.php nanti itu bisa sesuka-suka custom karena itu untuk jadi homepage nya, enaknya file itu dalam format PHP wuiiiih, contoh sedikit yang seperti di demo atas tadi :

    Code:
    <h2>This is Home Content</h2>
    <p>Hello, nama saya Mohamad Fahmi dan saya adalah temanmu di forum Bersosial.com</p>
     
  12. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Hampir semua fucntion yang diperlukan sudah ada jadi bisa saja digunakan untuk bikin situs sebuah perusahaan.

    Ingat dengan function ini?

    Code:
    // Get related posts base on post tag.
    function get_related($tag) {
       $perpage = config('related.count');
       $posts = get_tag(strip_tags($tag), 1, $perpage+1, true);
       $tmp = array();
       $req = $_SERVER['REQUEST_URI'];
    
       foreach ($posts as $post) {
         $url = $post->url;
         if( strpos($url, $req) === false){
           $tmp[] = $post;
         }
       }
    
       $total = count($tmp);
    
       if($total >= 1) {
      
         $i = 1;
         echo '<div class="related"><h4>Related posts</h4><ul>';
         foreach ($tmp as $post) {
           echo '<li><a href="' . $post->url . '">' . $post->title . '</a></li>';
           if ($i++ >= $perpage) break;
         }
         echo '</ul></div>';
       }
    
    }
    
    ada

    Code:
    $p->title
    $p->url
    
    harusnya kamu sadar kalau itu juga tersimpan misal

    Code:
    $p->body
    $p->date
    $p->tag
    
    dikembangkan bisa misal bikin function yang memanggil postingan tertentu untuk di frontpage :)
     
  13. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Misal sudah ada tag "seo" dan kita ingin ambil tinggal di filter yaa?
     
  14. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Bener. Sepertinya banyak kan situs semacam itu yang hanya memunculkan postingan tertentu misal Mashable.

    Bikin saja function baru berdasarkan itu. Jadi misal tag featured dll.
     
  15. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Wah ini sih bukan blog platform lagi, istilah nya bisa menjadi Web Magazine ini sih :D
     
  16. Ardilas

    Ardilas Super Level

    Joined:
    Feb 18, 2013
    Messages:
    4,243
    Likes Received:
    317
    Trophy Points:
    83
    Google+:
    Mas @Fahmi lagi iseng lagi nih
     
  17. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Kebangetan iseng ini sih hehehehe... :)
     
  18. ElSandy

    ElSandy New Member

    Joined:
    May 8, 2014
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Isengnya serius banget ya... *flying*kalo masalah koding ginian bikin ane *dizzy*
     
  19. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Hallo @ElSandy Salam kenal, iya awalnya kepikiran trus iseng, lumayan jadi bertambah pengetahuan kan :D
     
  20. ebaharu

    ebaharu Member

    Joined:
    Dec 5, 2012
    Messages:
    258
    Likes Received:
    12
    Trophy Points:
    18
    Google+:
    Saya masih kesulitan untuk memfilter salah satu tag, misalkan "seo" itu... boleh ajarin mas@fahmi
    heheheh atau klu boleh share dunk HTMLy yg sudah dimodifnya...
    Soalnya mantab nih HTMLy kayak yang http://fahmi.defaka.com
     
Loading...

Share This Page