• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Admin

Well-Known Member
Staff member
Administrator
Mô tả: mod có tác dụng lấy nội dung bài viết làm thẻ meta (keyword và description) cho topic
hướng dẫn
- Mở forum/index.php Tìm
PHP:
    $textl = mb_strlen($res['text']) > 30 ? $hdr . '...' : $hdr;

Thêm bên dưới
PHP:
    if($res['type']=='t') {
        $id_post = mysql_result(mysql_query("SELECT MIN(`id`) FROM `forum` WHERE `type`= 'm' AND `refid`='$id';"), 0);
        $q = mysql_fetch_assoc(mysql_query("SELECT `text` FROM `forum` WHERE `id`= '" . $id_post . "' LIMIT 1;"));
        functions::create_keywords($q['text'], ', ', 20);
    }

- Mở incfiles/classes/functions.php
thêm function bên dưới
PHP:
    public static function create_keywords($story, $separator = ', ', $keyword_count = 20) {

    global $set;
    
    $fastquotes = array ("\x22", "\x60", "\t", "\n", "\r", '"', "\\", '\r', '\n', "-", "{", "}", "[", "]" );
    $story1 = str_replace( $fastquotes, " ", $story );
    $story2 = preg_replace("/[^\w\x7F-\xFF\s]/", " ", $story1);
    $story = preg_replace("/ {,1}/", " ", $story2);
    
    $story3 = str_replace( $fastquotes, '', trim( strip_tags( str_replace( '<br />', ' ', stripslashes( $story1 ) ) ) ) );
    
    $story3 = preg_replace("/ {,1}/", " ", $story3);
    
    
    $set['meta_desc'] = mb_substr( $story3, 0, 190, 'UTF-8' );
    
    $arr = explode( " ", $story );
    
    foreach ( $arr as $word ) {
        if( mb_strlen( $word, 'UTF-8') > 4 ) $newarr[] = $word;
    }
    
    $arr = array_count_values( $newarr );
    arsort( $arr );
    
    $arr = array_keys( $arr );
    
    $total = count( $arr );
    
    $offset = 0;
    
    $arr = array_slice( $arr, $offset, $keyword_count );
    
    $set['meta_key'] = implode( $separator, $arr );

}
 
Đào tốp. Sao mình tìm mãi mà kg có dòng này thế $textl = mb_strlen ( $res [ 'text' ]) > 30 ? $hdr . '...' : $hdr ;
 

Facebook Comments

New posts New threads New resources

Back
Top