 | [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/06/2007 9:48 AM |
|
|
|
|
|
| Citation |
| Posts |
1017 |
| Word Cnt. |
64,643 |
| BDay |
Apr 18 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Apr 01, 2007
Local time: 6:33 PM
Location: UNITED ARAB EMIRATES
|

|
|
|
|
 |
Hello NightRider,
I just tried to install Dynamic Meta Tags
| Quote:
|
##############################################################
## MOD Title: phpBB SEO Dynamic Meta tags
## MOD Author: dcz <n/a> http://www.phpbb-seo.com/
## MOD Description: Generates dynamic metatags for phpBB.
##
## MOD Version: 0.2.0
##
## Installation Level: (EAZY)
## Installation Time: 5 Minutes
## Files To Edit: (6)
## index.php,
## viewforum.php,
## viewtopic.php,
## includes/page_header.php,
## template/subSilver/overall_header.tpl
## phpbb_seo/phpbb_seo_class.php
## Included Files: n/a
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## Author Notes:
## _____________
##
## This mod will add dynamic meta tags build out with the ending page's content.
## It's simple and efficient, will add specific meta tags to categories, forums and the index
## without adding any SQL Queries.
## A single SQL query is added in viewtopic.php, to grab the first post's most used words.
## 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
##
## In case you're using a portal, or if you whish to hard code default meta tags, you may want to change :
##
## 'meta_title_def' => $board_config['sitename'],
## 'meta_desc_def' => htmlspecialchars($board_config['site_desc']),
## 'meta_keywords_def' => htmlspecialchars($this->make_keywords($board_config['site_desc'])),
##
## And hard code infos about the portal. phpBB index will still use datas from the board config.
## These are used as default, in every file not specifying meta tags.
##
## UTF-8 and other Special Char-set :
## __________________________________
##
## You might want to use mb_strlen() instead of strlen()
## if you are using UTF-8 : mb_strlen($word, 'UTF-8')
## in phpbb_seo/phpbb_seo_class.php, in the make_keywords() function.
##
## 0.0.1 => 0.2.0 UPDATE :
## _______________________
##
## Update instructions are to be find in contrib/Dynamic_Metatags_V_0.0.1-0.2.0Update.txt
##
##############################################################
## MOD History:
##
## 2007-01-05 - 0.2.0
## - Saved one SQL query in all cases.
## - Added a function to filter small keywords (under 3 letters by default)
## limit and filter the keyword list.
## - Ready for unlimited meta tags add ons.
##
## 2006-10-06 - 0.0.1
## - First released version
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ DIY INSTRUCTIONS ]--------------------------------------------------
#
______________________________
NOTE : VERSION UPDATE CHECKING
______________________________
if you are using XS mod ( http://www.phpbbstyles.com/viewtopic.php?t=356 ), by the way you should,
Upload :
contrib/xs_dynamic_meta_tag.cfg
in your forum's admin/ folder, XS mod version checking will be extended to this mod.
____________________
NOTE : translations/
____________________
French Install files are in the translations/ folder of this release.
________________________________________
>>>> INSTALLATION INSTRUCTION <<<<<
________________________________________
If you install the mod standalone, eg, you can't find phpbb_seo/phpbb_seo_class.php on your ftp, please upload :
contrib/standalone/phpbb_seo/phpbb_seo_class.php
to your phpBB root folder.
And additionnally :
________
>>OPEN :
________
common.php
________
>>FIND :
________
if (file_exists('install') || file_exists('contrib'))
{
message_die(GENERAL_MESSAGE, 'Please_remove_install_contrib');
}
_______________
>>BEFORE, ADD :
_______________
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
include($phpbb_root_path . 'phpbb_seo/phpbb_seo_class.'.$phpEx);
$phpbb_seo = new phpbb_seo();
// www.phpBB-SEO.com SEO TOOLKIT END
And follow next steps.
#
#-----[ OPEN ]------------------------------------------
#
phpbb_seo/phpbb_seo_class.php
#
#-----[ FIND ]------------------------------------------
#
/**
* constuctor
*/
function phpbb_seo() {
#
#-----[ FIND ]------------------------------------------
#
return;
}
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// --> Meta tags
$this->seo_meta_tags();
#
#-----[ FIND ]------------------------------------------
#
}
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// -- > Meta tags
var $seo_meta = array();
/**
* Returns meta tag code
*/
function build_meta($page_title = '') {
$meta_desc = ( $this->seo_meta['meta_desc'] != '' ) ? $this->seo_meta['meta_desc'] : $this->seo_meta['meta_desc_def'];
$keywords = ( $this->seo_meta['keywords'] != '' ) ? $this->seo_meta['keywords'] : $this->seo_meta['meta_keywords_def'];
$title = ( $this->seo_meta['meta_title'] != '' ) ? $this->seo_meta['meta_title'] : $page_title;
return sprintf( $this->seo_meta['meta_tpl'], $title, $this->seo_meta['meta_lang'], $meta_desc, $keywords, $this->seo_meta['meta_cat'], $this->seo_meta['meta_robots'] );
}
/**
* Returns a word list separated by comas
* You might want tu use mb_strlen() instead of strlen()
* if you are using UTF-8 : mb_strlen($word, 'UTF-8')
* you can as well change the minimum word size here : if ( strlen($word) >= 3 ) {
* Possible Options :
* - $limit = 0 means no limit.
* By default, ' . and , are deleted.
*/
function make_keywords($text, $limit = 15) {
$keywords = '';
$num = 0;
$text = preg_replace(array("`[[:punct:]]+`", "`[\s]+`"), array(" ", " "), strip_tags($text) );
$text = explode(" ", $text);
// We take the most used words first
$text = array_count_values($text);
foreach ($text as $word => $count) {
if ( strlen($word) >= 3 ) {
$keywords .= ($keywords == '') ? $word : ',' . $word;
$num++;
if ( $limit > 0 && $num >= $limit ) {
break;
}
}
}
return $keywords;
}
/**
* Filter php/html tags and white spaces and returns htmlspecialchared string
*/
function meta_filter_txt($text) {
return htmlspecialchars(preg_replace("`[\s]+`", " ", strip_tags($text) ) );
}
/**
* Initialize meta tags
* @access private
*/
function seo_meta_tags() {
global $board_config;
$this->seo_meta = array('meta_tpl' => '<meta name="title" content="%s">' . "\n" . '<meta name="description" lang="%s" content="%s">' . "\n" . '<meta name="keywords" content="%s">' . "\n" . '<meta name="category" content="%s">' . "\n" . '<meta name="robots" content="%s">'. "\n",
'meta_title' => '',
'meta_desc' => '',
'meta_keywords' => '',
// Here you can hard code a static default title, description and keywords
// As is, the mod will return information based on the phpbb config
'meta_title_def' => $this->meta_filter_txt($board_config['sitename']),
'meta_desc_def' => $this->meta_filter_txt($board_config['site_desc']),
'meta_keywords_def' => $this->make_keywords($board_config['site_desc']),
'meta_lang' => 'en',
'meta_cat' => 'general',
'meta_robots' => 'index,follow',
'meta_gened' => FALSE
);
return;
}
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// www.phpBB-SEO.com SEO TOOLKIT BEGIN - META
$phpbb_seo->seo_meta['meta_desc'] = $phpbb_seo->meta_filter_txt("$page_title : " . $phpbb_seo->seo_meta['meta_desc_def']);
$phpbb_seo->seo_meta['keywords'] = $phpbb_seo->make_keywords($phpbb_seo->seo_meta['meta_desc']);
// www.phpBB-SEO.com SEO TOOLKIT END - META
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// www.phpBB-SEO.com SEO TOOLKIT BEGIN - META
$phpbb_seo->seo_meta['meta_desc'] = $phpbb_seo->meta_filter_txt($board_config['sitename'] . " : $page_title : " . $forum_row['forum_desc']);
$phpbb_seo->seo_meta['keywords'] = $phpbb_seo->make_keywords($phpbb_seo->seo_meta['meta_desc']);
// www.phpBB-SEO.com SEO TOOLKIT END - META
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// www.phpBB-SEO.com SEO TOOLKIT BEGIN - META
$phpbb_seo->seo_meta['meta_desc'] = $phpbb_seo->meta_filter_txt($board_config['sitename'] . " : $page_title");
$m_kewrd = '';
$sql = "SELECT w.word_text
FROM " . TOPICS_TABLE . " t, " . SEARCH_MATCH_TABLE . " m, " . SEARCH_WORD_TABLE . " w
WHERE t.topic_id = $topic_id
AND t.topic_first_post_id = m.post_id
AND m.word_id = w.word_id LIMIT 15";
if( ($result = $db->sql_query($sql)) ) {
while ( $meta_row = $db->sql_fetchrow($result) ) {
$m_kewrd .= " " . $meta_row['word_text'];
}
}
$phpbb_seo->seo_meta['keywords'] = $phpbb_seo->make_keywords("$m_kewrd " . $phpbb_seo->seo_meta['meta_desc']);
// www.phpBB-SEO.com SEO TOOLKIT END - META
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ DIY INSTRUCTIONS ]--------------------------------------------------
#
In order to allow full compatibility with any mods, we need here to check if the
phpbb_seo class was started.
This is the case with several add ons, two scenario are thus possible to optimize a bit.
If you can find :
if (is_object($phpbb_seo) ) {
Then add before :
$seo_meta = "";
And after :
// phpBB SEO - META
$seo_meta = $phpbb_seo->build_meta($page_title);
And skip the next FIND and BEFORE ADD.
If not, or if you are unsure about this, just follow the next FIND and BEFORE ADD.
#
#-----[ FIND ]------------------------------------------
# Please read the above DIY before doing this step
$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],
#
#-----[ BEFORE, ADD ]------------------------------------------
# Please read the above DIY before doing this step
// www.phpBB-SEO.com SEO TOOLKIT BEGIN - META
$seo_meta = "";
if (is_object($phpbb_seo) ) {
// phpBB SEO - META
$seo_meta = $phpbb_seo->build_meta($page_title);
}
// www.phpBB-SEO.com SEO TOOLKIT END - META
#
#-----[ FIND ]------------------------------------------
#
'PAGE_TITLE' => $page_title,
#
#-----[ AFTER ADD ]------------------------------------------
#
// www.phpBB-SEO.com - META
'META_TAG' => $seo_meta,
// www.phpBB-SEO.com - META
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
{META}
#
#-----[ BEFORE, ADD]------------------------------------------
#
{META_TAG}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
|
in which i get 1 error at last
| Quote:
|
Critical Error
FIND FAILED: In file [templates/subSilver/overall_header.tpl] could not find:
{META}
MOD script line #378 :: FAQ :: Report
|
which i was unable to solve it. I can't find FIND statement in overall_header.tpl at all
Any idea what to do  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Dynamic Meta Tags MOD |  |
Posted: 05/06/2007 2:53 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 10:33 AM
Location: St Pete, FL
|

|
|
|
|
 |
My guess is that this MOD is relying on the other SEO MOD to have added the META tag in the overall_header.tpl file. You can fix this error by doing the following:
OPEN
phpbb-SEO-dynamic_meta_tagsV_0.2.0.txt
FIND
| Code:
|
#
#-----[ FIND ]------------------------------------------
#
{META}
|
REPLACE WITH
| Code:
|
#
#-----[ FIND ]------------------------------------------
#
<meta name="description"
|
Save, upload, and try again using EM...
I bet the other META tags in the overall_header.tpl file should have been removed too. I really don't know how much this MOD adds, but I bet that part or all of the following would be redundant after this MOD was installed:
| Code:
|
<meta name="description" content="The First Fun Island On Internet Where Entertainment Enjoys Itself!">
<meta name="keywords" content="free ringtones, free mobile games, mobile games, ps 2 game cheats, games play, play game, free online games, free music downloads, free games, music lyrics, free music downloads, music videos, free e-cards, mp3 downloads, love songs, free mp3 downloads, home video, funny videos, comedy central, free radio stations, mixed wrestling, wwe divas, games cheat, kids games, play games online free, video games, cookie recipes, watch online movies, download bollywood movies, download hollywood movies, download cartoons, music videos, hindi music, live cricket, mobile softwares, mobile games, computer games, computer softwares, mehndi designs, fashion wadi, gossip wadi, fashion tips.">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="content-language" content="en">
|
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/06/2007 3:06 PM |
|
|
|
|
|
| Citation |
| Posts |
1017 |
| Word Cnt. |
64,643 |
| BDay |
Apr 18 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Apr 01, 2007
Local time: 6:33 PM
Location: UNITED ARAB EMIRATES
|

|
|
|
|
 |
Yeah, you are right. This MOD rely on other phpbb-seo MODs but i don't know what it removed and all
As you said
| Quote:
|
#
#-----[ FIND ]------------------------------------------
#
{META}
|
to replace with
| Quote:
|
#
#-----[ FIND ]------------------------------------------
#
<meta name="description"
|
But you said both FIND
where as 1st one is FIND and the other is BEFORE, ADD. So i should add BEFORE, ADD statement in the second one right? |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Dynamic Meta Tags MOD |  |
Posted: 05/06/2007 3:13 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 10:33 AM
Location: St Pete, FL
|

|
|
|
|
 |
No, you are only replacing the FIND with my suggested FIND. The FIND is what's failing, not the BEFORE, ADD statement...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/06/2007 3:28 PM |
|
|
|
|
|
| Citation |
| Posts |
1017 |
| Word Cnt. |
64,643 |
| BDay |
Apr 18 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Apr 01, 2007
Local time: 6:33 PM
Location: UNITED ARAB EMIRATES
|

|
|
|
|
 |
Oh yeah. I am so dumb
It installed perfectly and working nicely. This phpbb-seo have made some great SEO MODs. Fantastic MODs
You can install the Advanced Rewrite MOD, Dynatic Meta Tags MOD, SEO Optimal titles MOD, Zero dupilcate - phpBB SEO Advanced MOD, etc
All are good for RCF SEO. |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Dynamic Meta Tags MOD |  |
Posted: 05/06/2007 4:06 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 10:33 AM
Location: St Pete, FL
|

|
|
|
|
 |
Great!!! Congratulations AB!!!
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/07/2007 3:05 AM |
|
|
|
|
|
| Citation |
| Posts |
1017 |
| Word Cnt. |
64,643 |
| BDay |
Apr 18 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Apr 01, 2007
Local time: 6:33 PM
Location: UNITED ARAB EMIRATES
|

|
|
|
|
 |
Thanks.. All is because of you. Without you my forum would not exist.
Today we have reached the mark of 20,000 members
Thanks a lot brother  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/07/2007 1:41 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 10:33 AM
Location: St Pete, FL
|

|
|
|
|
 |
Wow, 20,000 members is awesome. What was the start date of your community???
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/07/2007 2:28 PM |
|
|
|
|
|
| Citation |
| Posts |
1017 |
| Word Cnt. |
64,643 |
| BDay |
Apr 18 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Apr 01, 2007
Local time: 6:33 PM
Location: UNITED ARAB EMIRATES
|

|
|
|
|
 |
Start date was 12th October  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] Dynamic Meta Tags MOD |  |
Posted: 05/07/2007 3:17 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 10:33 AM
Location: St Pete, FL
|

|
|
|
|
 |
20,000 new members in less than 8 months must be a record...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Information |  |
|