HTMLy: Rubah permalink URL [mod]

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

Thread Status:
Not open for further replies.
  1. Ardilas

    Ardilas Super Level

    Joined:
    Feb 18, 2013
    Messages:
    4,245
    Likes Received:
    317
    Trophy Points:
    83
    Google+:
    Menunggu kalau sudah fix saja deh, kalau bisa dijadikan plugin :)
    Kalau terlalu ribet mending gak usah :D
     
  2. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Update, sudah saya upload, silahkan yang mau pake atau ujicoba... ini permalink jadi rasa rasa WP yah *berkeringat*
     
  3. billatransport

    billatransport Member

    Joined:
    Apr 8, 2014
    Messages:
    145
    Likes Received:
    4
    Trophy Points:
    18
    Google+:
    Aku juga pake HTMLy di salah satu web saya..yang paling saya suka loadingnya cepet...
    Kalu udah ada support plugin nya mantab deh...
     
  4. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Sebenarnya tidak perlu merubah semua, cukup menambahkan misal:

    Code:
    get('/topic/:name', function($name){
    
    // Misal bikin config baru
    $permalink_type= config('permalink');
    
    // Standar if else
    
    });
    
     
  5. ncang

    ncang Super Level

    Joined:
    Feb 7, 2013
    Messages:
    4,627
    Likes Received:
    753
    Trophy Points:
    113
    Google+:
    Wah kayaknya sebentar lagi jadi deh plugin.
    kemana nih yang bikin thread, ini sudah mendekati banget , @Fahmi lanjutkan perjuangan mu !
     
  6. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Merubah post url menjadi /topic/ mas Dan? dan ada settingnya di config mau rubah apa gak gitu ya? akhirnya dibuka lagi kode nya :D
     
  7. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Bukan jadi misal nanti ada config baru yang menentukan pakai permalink seperti apa, misal custom dan kalau custom kita bisa set prefixnya juga:

    Code:
    permalink_prefix = "topic"
    
    /topic/url-postingan
    
    dan kalau set default kayak URL yang sekarang :)

    Dan nanti di admin juga ambil date menggunakan explode, persis yang saya lakukan ketika mengambil tag, url dari filenya :D
     
  8. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Lanjutkan pliss :D kayaknya lebih bagus gini deh, user bisa memilih mau pakai prefix kaya gimana :)
     
  9. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Dan menjadi lebih keren misal sebelum error 404 dibikin semacam pencarian dulu dengan matching url postingan jadi meskipun gonta-ganti permalink tetap mengarah ke satu file :)
     
  10. ncang

    ncang Super Level

    Joined:
    Feb 7, 2013
    Messages:
    4,627
    Likes Received:
    753
    Trophy Points:
    113
    Google+:
    tuh kan @Fahmi, Mas Den @Dan rubah bersosial dari drupal ke phpbb terus ke xenforo aja bisa, apalagi cuma custom permalink htmly :D
     
  11. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Advanced Soft 404 ini sih :D --- Wah kayaknya akan menambah fitur nih, sekalian multi tag related mas @Dan :)

    Hehehe iyalah, @senpai gitu lho :)
     
  12. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Related sudah multi tag sebenarnya tapi terlalu random untuk menghemat CPU, coba saja resfresh halaman, perbandingan misal tag A 1 postingan dan tag B 15 postingan berarti kemungkinan munculnya postingan tag A sedikit.

    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);
    
    Yang true itu saya random khusus buat related saja.

    Code:
    // Return tag page.
    function get_tag($tag, $page, $perpage, $random){
    
       $posts = get_post_sorted();
      
       if($random === true) {
         shuffle($posts);
       }
    
    Update: contohnya http://www.serverios.com/2014/03/iniz-7tahun-ram-128mb-openvz
     
  13. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Kalau gitu dibikin 2 atau 3 saja gitu mas dan?
    Code:
    2, $perpage+1, true
     
  14. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Maksud dari $perpage+1 itu misal related tag di set ke 4 maka saya ambil 5 untuk mensiasati misal ketika pengambilan postingan setelah di radom ternyata menyertakan postingan tersebut:

    Code:
      $req = $_SERVER['REQUEST_URI'];
       
       foreach ($posts as $post) {
         $url = $post->url;
         if( strpos($url, $req) === false){
           $tmp[] = $post;
         }
       }
    
    waduh kode ini sepertinya kurang relevan:

    Code:
      $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>';
       }
    
     
  15. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Kurang relevan apanya mas Dan? :)
     
  16. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Mas @Dan , kalau render Home -- misal mau buat layout baru "Home" berisi Static page dan beberapa widget latest post dan featured bisa gk dibuat? :)
     
  17. Dan

    Dan Forum Bot

    Joined:
    Dec 4, 2012
    Messages:
    1,316
    Likes Received:
    257
    Trophy Points:
    83
    Google+:
    Bisa tapi perlu penambahan kode juga :)
     
  18. Fahmi

    Fahmi Newbie

    Joined:
    Dec 5, 2012
    Messages:
    1,719
    Likes Received:
    159
    Trophy Points:
    63
    Google+:
    Ah ini kayaknya lebih asik mas @Dan :) request dong
     
  19. pram

    pram Well-Known Member

    Joined:
    Sep 23, 2013
    Messages:
    3,099
    Likes Received:
    161
    Trophy Points:
    63
    Google+:
    Mas Dan saya sudah menggunakan Ini di .htacces kok nggak keredirect ya? :)
     
  20. salak putih

    salak putih New Member

    Joined:
    Oct 4, 2014
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Google+:
    mau tanya nih. Untuk akhiran permalink bkog, bagusnya yang pake .html atau tanpa.html ?
     
Loading...
Thread Status:
Not open for further replies.

Share This Page