phpBB2 by Przemo
Support forów phpBB2 modified by Przemo

FAQFAQ - PIERWSZA POMOC!!  regulaminREGULAMIN  SzukajSZUKAJ  UżytkownicyUżytkownicy  GrupyGrupy  StatystykiStatystyki
RejestracjaRejestracja  ZalogujZaloguj  DownloadDownload  katalog Forów DyskusyjnychKatalog Forów   FAQ Video tutoriale

Poprzedni temat «» Następny temat
Przesunięty przez: joli
22-01-2009, 18:57
Dynamiczne tagi META
Autor Wiadomość
Lololowski

Posty: 92
Wysłany: 16-08-2007, 22:50   Dynamiczne tagi META

używam aktualnie modyfikacji:
Kod:

##############################################################
## MOD Title: phpBB SEO Dynamic Metatags
##
## MOD Author: dcz <n/a> http://www.phpbb-seo.com/
##
## MOD Description: Generates dynamic metatags for phpBB.
##
## MOD Version: 0.0.1
##
## Installation Level: Easy
## Installation Time: 2 Minutes
## Files To Edit: (2)
##            includes/page_header.php,
##            templates/subSilver/overall_header.tpl
##
## Included Files: n/a
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## Author Notes:
##
## You can edit the amount of keywords outputted for topics by editing the number in this line:
## AND t.topic_id = $meta_topic_id LIMIT 20";
## Part of this code inspired from -http://www.phpbb.de/viewtopic.php?t=49679 Larsneo and Titus (@phpbb.de)
## You SHOULD NOT use more than 20 keywords in the keyword meta tags
## As well, you SHOULD NOT use too long description tags
##
##############################################################
## MOD History:
##
##    2006-10-06 - First released version
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
define('HEADER_INC', TRUE);
#
#-----[ AFTER, ADD  ]------------------------------------------
# If you use the phpbbstyle.com sql cache system, just look for //SQL CACHE and
# uncomment (and comment) the proper lines
# Also, make sure you change FEW_MORE_KEYWORDS_COMA_SEPARATED, YOUR_DEFAUT_DESCRITPION,
# YOUR_DEFAULT_KEYWORDS_COMA_SEPARATED, YOUR_AUTHOR_INFOS & YOUR_COPYRIGHT_INFOS with the proper infos.
# Note : YOUR_AUTHOR_INFOS & YOUR_COPYRIGHT_INFOS lines are commented by default, because it is not
# needed in most cases. Uncomment the proper lines if you want those to be outputted as well.
//BEGIN www.phpBB-SEO.com Dynamic meta tags
if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) {
    $meta_topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
} elseif ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) {
    $meta_forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
} elseif ( isset($HTTP_GET_VARS[POST_CAT_URL]) ) {
    $meta_cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);
}
if ( isset($meta_topic_id) ) {
    $sql = "SELECT c.cat_title, f.forum_name, t.topic_title
                FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
                WHERE f.forum_id = t.forum_id
                AND c.cat_id = f.cat_id
                AND t.topic_id = $meta_topic_id";
        if( ($result = $db->sql_query($sql)) ) {
        if ( $meta_row = $db->sql_fetchrow($result) ) {
            $description = $board_config['sitename'] . ' :: ' . $meta_row['cat_title'] . ' :: ' . $meta_row['forum_name'] . ' :: ' . $meta_row['topic_title'];
        }
        }
        $sql = "SELECT w.word_text
                FROM " . TOPICS_TABLE . " t, " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w
                WHERE t.topic_first_post_id = m.post_id
                AND m.word_id = w.word_id
                AND t.topic_id = $meta_topic_id LIMIT 20";
        if( ($result = $db->sql_query($sql)) ) {
        $keywords = '';
        while ( $meta_row = $db->sql_fetchrow($result) ) {
            $keywords .= ($keywords == '') ? $meta_row['word_text'] : ',' . $meta_row['word_text'];
        }
        }
} elseif ( isset($meta_forum_id) ) {
    $sql = "SELECT c.cat_title, f.forum_name
                FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
                WHERE c.cat_id = f.cat_id
                AND f.forum_id = $meta_forum_id";
    //SQL CACHE
           if( ($result = $db->sql_query($sql)) ) {
    //if( ($result = $db->sql_query($sql, false, 'META_')) ) {
        if ( $meta_row = $db->sql_fetchrow($result) ) {
            $description = $board_config['sitename'] . ' :: ' . $meta_row['cat_title'] . ' :: ' . $meta_row['forum_name'];
            $keywords = $board_config['sitename'] . ', ' . $meta_row['cat_title'] . ', ' . $meta_row['forum_name'] . ', FEW_MORE_KEYWORDS_COMA_SEPARATED';
        }
        //here we clear $result from ram and cache it
        $db->sql_freeresult($result);
        //End sql cache opt
           }
} elseif ( isset($meta_cat_id) ) {
    $sql = "SELECT cat_title
                FROM " . CATEGORIES_TABLE . "
                WHERE cat_id = $meta_cat_id";
    //SQL CACHE
        if( ($result = $db->sql_query($sql)) ) {
    //if( ($result = $db->sql_query($sql, false, 'META_')) ) {
        if ( $meta_row = $db->sql_fetchrow($result) ) {
            $keywords = $board_config['sitename'] . ', ' . $meta_row['cat_title'] . ', FEW_MORE_KEYWORDS_COMA_SEPARATED';
            $description = $board_config['sitename'] . ' :: ' . $meta_row['cat_title'];
        }
        //here we clear $result from ram and cache it
        $db->sql_freeresult($result);
        //End sql cache opt
    }
} else {
    $description .= 'YOUR_DEFAUT_DESCRITPION';
    $keywords = 'YOUR_DEFAULT_KEYWORDS_COMA_SEPARATED';
}
$phpbb_meta  = '<meta name="title" content="' . $page_title .'">' . "\n";
//$meta_str .= '<meta name="author" content=" YOUR_AUTHOR_INFOS ">' . "\n";
//$meta_str .= '<meta name="copyright" content=" YOUR_COPYRIGHT_INFOS ">' . "\n";
$phpbb_meta .= '<meta name="keywords" content="' . $keywords  .'">' . "\n";
$phpbb_meta .= '<meta name="description" lang="fr" content="'. $description .'">' . "\n";
$phpbb_meta .= '<meta name="category" content="general">' . "\n";
$phpbb_meta .= '<meta name="robots" content="index, follow">' . "\n";
//END  www.phpBB-SEO.com Dynamic meta tags
#
#-----[ FIND ]------------------------------------------------
#
    'PAGE_TITLE' => $page_title,
#
#-----[ AFTER, ADD ]------------------------------------------
#
    //BEGIN www.phpBB-SEO.com Dynamic meta tags
    'META_TAG' => $phpbb_meta,
    //END www.phpBB-SEO.com Dynamic meta tags   
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------------
#
<META http-equiv="Content-Style-Type" content="text/css" />
#
#-----[ AFTER, ADD ]------------------------------------------
#
{META_TAG}
#
#---[ SAVE/CLOSE ALL FILES ]-----------------------
#
# eom


i jestem ciekaw jak zrobić, żeby w tagu Description pojawiały się pierwsze powiedzmy 250 znaków pierwszego postu ?

[ Dodano: 17-08-2007, 02:44 ]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Zrobiłem tak:
Kod:


//BEGIN www.phpBB-SEO.com Dynamic meta tags
if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) )
    {
        $meta_topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
    }
elseif ( isset($HTTP_GET_VARS[POST_FORUM_URL]) )
    {
        $meta_forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
    }
elseif ( isset($HTTP_GET_VARS[POST_CAT_URL]) )
    {
    $meta_cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);
    }

if ( isset($meta_topic_id) )
    {
        $sql = "SELECT phpbb_posts_text.post_text FROM phpbb_topics, phpbb_posts_text WHERE phpbb_topics.topic_first_post_id = phpbb_posts_text.post_id AND phpbb_topics.topic_id = $meta_topic_id";
        if( ($result = $db->sql_query($sql)) )
            {
                if ( $meta_row = $db->sql_fetchrow($result) )
                    {
                        $meta_p_prep = $meta_row['post_text'];
                    }
            }
       
        $sql = "SELECT w.word_text
                FROM " . TOPICS_TABLE . " t, " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w
                WHERE t.topic_first_post_id = m.post_id
                AND m.word_id = w.word_id
                AND t.topic_id = $meta_topic_id LIMIT 20";
        if( ($result = $db->sql_query($sql)) )
            {
                $keywords = '';
                while ( $meta_row = $db->sql_fetchrow($result) )
                    {
                        $keywords .= ($keywords == '') ? $meta_row['word_text'] : ',' . $meta_row['word_text'];
                    }
            }
   
        if ( strlen($meta_p_prep) <= 250 )
            {
                $description = $meta_p_prep;
            }
        elseif ( strlen($meta_p_prep) > 250 )
            {
                //$desc_p_prep = str_split($meta_p_prep, 197);
                $out_a = chunk_split($meta_p_prep, 197, '#');
                $desc_p_prep = explode("#", $out_a);
                $description_r = $desc_p_prep[0];
                $description = $description_r . '...';
               
            }
               
    }
elseif ( isset($meta_forum_id) )
    {
        $sql = "SELECT c.cat_title, f.forum_name
                FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
                WHERE c.cat_id = f.cat_id
                AND f.forum_id = $meta_forum_id";
        //SQL CACHE
           if( ($result = $db->sql_query($sql)) )
            {
        //if( ($result = $db->sql_query($sql, false, 'META_')) ) {
                if ( $meta_row = $db->sql_fetchrow($result) )
                    {
                        $description = $board_config['sitename'] . ' :: ' . $meta_row['cat_title'] . ' :: ' . $meta_row['forum_name'];
                        $keywords = $board_config['sitename'] . ', ' . $meta_row['cat_title'] . ', ' . $meta_row['forum_name'] . ', FEW_MORE_KEYWORDS_COMA_SEPARATED';
                    }
                //here we clear $result from ram and cache it
                $db->sql_freeresult($result);
        //End sql cache opt
            }
    }
elseif ( isset($meta_cat_id) )
    {
        $sql = "SELECT cat_title
                FROM " . CATEGORIES_TABLE . "
                WHERE cat_id = $meta_cat_id";
        //SQL CACHE
        if( ($result = $db->sql_query($sql)) )
            {
        //if( ($result = $db->sql_query($sql, false, 'META_')) ) {
                if ( $meta_row = $db->sql_fetchrow($result) )
                    {
                        $keywords = $board_config['sitename'] . ', ' . $meta_row['cat_title'] . ', FEW_MORE_KEYWORDS_COMA_SEPARATED';
                        $description = $board_config['sitename'] . ' :: ' . $meta_row['cat_title'];
                    }
                //here we clear $result from ram and cache it
                $db->sql_freeresult($result);
        //End sql cache opt
            }
    }
else
    {
        $description .= 'Oficjalne Polskie Forum Supportowe systemu Dreamlinux';
        $keywords = 'dystrybucja, dreamlinux, download, support, poradniki, porady, faq, tutorial, xfce, beryl, multi, media';
    }



//$phpbb_meta  = '<meta name="title" content="'. $description .'">' . "\n";
$meta_str .= '<meta name="author" content=" Greg00pl ">' . "\n";
$meta_str .= '<meta name="copyright" content=" Dreamlinux.eu ">' . "\n";
$phpbb_meta .= '<meta name="keywords" content="' . $keywords  .'">' . "\n";
$phpbb_meta .= '<meta name="description" lang="pl" content="' . $description .'">' . "\n";
$phpbb_meta .= '<meta name="category" content="general">' . "\n";
$phpbb_meta .= '<meta name="robots" content="index, follow">' . "\n";
//END  www.phpBB-SEO.com Dynamic meta tags


no i mam treść pierwszego posta w description, ale nie takiej długości jakbym chciał...

Jakby ktoś wpadł na to jak to zrobić "lepiej" to będę wdzięczny za odzew ;)
 
     
Gadatliwa Kasia 

   
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Kopiowanie wszelkich treści zawartych na forum, modyfikacji oraz instrukcji bez zgody administracji i autorów tematów/postów zabronione!

Powered by phpBB modified by Przemo © 2003 phpBB
Strona wygenerowana w 0,11 sekundy. Zapytań do SQL: 12
Polecane serwisy

Najlepsze oprogramowanie do prowadzenia sklepu internetowegoNajlepszy program do sklepu firmowany przez Przem'a

Sklep z gadżetami

serwis laptopów

phpbb

Design Cart - Tworzenie sklepu internetowego

iRonin.IT

• Zamów reklamę