PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Mon Apr 17, 2006 4:57 pm Reply with quote Back to top

Hi all:

I searching and searching for a Dynamic Meta Tag Mod. I use the Dynamic Title Mod, it works great. But I wish to have unique discription tags also, not the run of site tags.

I found Dymetakeys here:
Only registered users can see links on this board!
Get registered or login to the forums!
but that is very old and only does the news articles, I need the forums, FAQ's, reviews...

I also found related discussions about phpnukeseopack.zip here:
Only registered users can see links on this board!
Get registered or login to the forums!
but all the links are useless.

Any ideas where I could find a Dynamic Meta Tag Mod?
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Mon Apr 17, 2006 8:17 pm Reply with quote Back to top

Our approach for nukeSEO will be meta keywords by module, rather than fully dynamic meta keys. If you use dynamic meta keys for user-submitted content, you might use some inappropriate meta keywords... How should it decide which keywords to use dynamically?
View user's profile Send private message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Mon Apr 17, 2006 9:32 pm Reply with quote Back to top

kguske wrote:
Our approach for nukeSEO will be meta keywords by module, rather than fully dynamic meta keys. If you use dynamic meta keys for user-submitted content, you might use some inappropriate meta keywords... How should it decide which keywords to use dynamically?


I am not so much concerned about keyword meta, I am more concerned about discription.

For discription, i would love it to either pull the Title and the first 150 charactors of content in all forum posts/topics and for all other mods just the Title.

The actual description itself is not important to me, the uniqueness of the description vs a run of site one is.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Tue Apr 18, 2006 5:51 am Reply with quote Back to top

Hmmm...an interesting idea. That's not too different from the way the nukeSEO sitemap works...
View user's profile Send private message
guidyy
Worker
Worker


Joined: Nov 22, 2004
Posts: 208
Location: Italy

PostPosted: Tue Apr 18, 2006 6:02 am Reply with quote Back to top

I do it with a modified version of dynamic title.
I have a meta.php file for each module, that grab title and 150 characters from the content.
The only problem is with BBCODE in forums.
If you query from database you could get something like this

Code:
Why   dry and store?
[size=24:2199834232]   EAT!!!!!!!!![/size:2199834232]  :D  :D  :D  :wink:

That is really not a good description....
You can strip out HTML quite easy in PHP, but what about bbcodes?
Guido
View user's profile Send private message Visit poster's website MSN Messenger
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Tue Apr 18, 2006 7:02 am Reply with quote Back to top

guidyy wrote:
I do it with a modified version of dynamic title.
I have a meta.php file for each module, that grab title and 150 characters from the content.
The only problem is with BBCODE in forums.
If you query from database you could get something like this

Code:
Why   dry and store?
[size=24:2199834232]   EAT!!!!!!!!![/size:2199834232]  :D  :D  :D  :wink:

That is really not a good description....
You can strip out HTML quite easy in PHP, but what about bbcodes?
Guido


Guidyy: Care to share that code?
View user's profile Send private message
guidyy
Worker
Worker


Joined: Nov 22, 2004
Posts: 208
Location: Italy

PostPosted: Tue Apr 18, 2006 7:59 am Reply with quote Back to top

It's nothing fancy:

This is the meta.php for encyclopedia, because I disabled it in forums for the bbcoode and News on my site are disabled.
It's a cooking site so on my home I have the recipes module so i have metadescription for Recipes, Ingredients, Encyclopedia, Docs.
Anyway it's not very hard to call database for the needed tables.

Please note: I'm almost a complete php dumbass, so i've probably made mistakes. It works on my site but no warranties!
Note2: This was made for phpnuke 6.9 patched 2.8

Code:

<?php

# $Author: chatserv $
# $Date: 2004/11/01 03:56:44 $
/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/


if (stristr($_SERVER['SCRIPT_NAME'], "meta.php")) {
    Header("Location: ../index.php");
    die();
}

global $name;
include ("config.php");
include("db/db.php");
// encyclopedia
if($name=="Encyclopedia"){
global $op,$eid,$tid, $desc;

if($op=="list_content") {
$sql="SELECT eid, description FROM nuke_encyclopedia WHERE eid='$eid'";
   $result = $db->sql_query($sql);
   $row = $db->sql_fetchrow($result);
   $desc = $row[description];
  $MyNewDesc = "$desc";
 }
if($op=="terms") {
$sql="SELECT eid, title FROM nuke_encyclopedia WHERE eid=$eid";
   $result = $db->sql_query($sql);
   $row = $db->sql_fetchrow($result);
   $texto = $row[title];
  $MyNewDesc = "Alphabetical list of terms contained in $texto encyclopedia";
 }
if($op=="content") {
$sql="SELECT tid, title text, eid FROM nuke_encyclopedia_text WHERE tid='$tid'";
   $result = $db->sql_query($sql);
   $row = $db->sql_fetchrow($result);
   $term = $row[text];
        $MyNewDesc = "$term";
}
 }

$search = array ("'<s cript[^>]*?>.*?</sc ript>'si",
                      "'<[\/\!]*?[^<>]*?>'si",
                      "'([\r\n])[\s]+'",
                      "'&(amp|#38);'i",
                      "'&(lt|#60);'i",
                      "'&(gt|#62);'i",
                      "'&(nbsp|#160);'i",
                      "'&(iexcl|#161);'i",
                      "'&(cent|#162);'i",
                      "'&(pound|#163);'i",
                      "'&(copy|#169);'i",
                      "'&#(\d+);'e"
                      );
$replace = array ( "",
                      "",
                      "\\1",
                      "&",
                      "<",
                      ">",
                      " ",
                      chr(161),
                      chr(162),
                      chr(163),
                      chr(169),
                      "chr(\\1)"
                      );

     $MyNewDesc = preg_replace($search, $replace, $MyNewDesc);



$description = substr($MyNewDesc,0,150);




##################################################
# Include for Meta Tags generation               #
##################################################

echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="._CHARSET."\">\n";
#echo "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">\n";
#echo "<META NAME=\"RESOURCE-TYPE\" CONTENT=\"DOCUMENT\">\n";
echo "<META NAME=\"DISTRIBUTION\" CONTENT=\"GLOBAL\">\n";

echo "<META NAME=\"COPYRIGHT\" CONTENT=\"Copyright (c) 2004 by $sitename\">\n";
echo "<META NAME=\"KEYWORDS\" CONTENT=\"Encyclopedia, cooking terms,  french cooking terms, kitchen tools and toys glossary, cooking measure conversions, italian cooking terms, liquor,spirits,how-to, bartender encyclopedia, canning, cooking, mixing cocktails \">\n";
echo "<META NAME=\"DESCRIPTION\" CONTENT=\"$description\">\n";
echo "<META NAME=\"ROBOTS\" CONTENT=\"INDEX, FOLLOW, NOARCHIVE\">\n";
echo "<META NAME=\"REVISIT-AFTER\" CONTENT=\"7 DAYS\">\n";



#echo "<META NAME=\"RATING\" CONTENT=\"GENERAL\">\n";

###############################################
# DO NOT REMOVE THE FOLLOWING COPYRIGHT LINE! #
# YOU'RE NOT ALLOWED TO REMOVE NOR EDIT THIS. #
###############################################

echo "<META NAME=\"GENERATOR\" CONTENT=\"PHP-Nuke $Version_Num - Copyright 2003 by http://phpnuke.org\">\n";
# $Log: meta.php,v $
# Revision 1.1  2004/11/01 03:56:44  chatserv
# Initial CVS Addition
#

?>


In header.php
find
Code:

include("includes/meta.php");

Replace with
Code:

    if (isset($module_name) && file_exists("modules/$module_name/meta.php")) {

               include("modules/$module_name/meta.php");   }
    else     {
        include("includes/meta.php");
        }


I am sure, a php expert could do much better, without all those calls to the database, but for my limited skills, this was the easiest way.
Do not shoot on the pianist! Very Happy
Guido
View user's profile Send private message Visit poster's website MSN Messenger
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Tue Apr 18, 2006 8:23 am Reply with quote Back to top

Thank you guidyy.

So if I understand it correctly, you make a unique file from the above code and place it in each directory, correct?

Also, is that the same file for the forums? Or is the forum file different?
View user's profile Send private message
guidyy
Worker
Worker


Joined: Nov 22, 2004
Posts: 208
Location: Italy

PostPosted: Tue Apr 18, 2006 8:41 am Reply with quote Back to top

Correct.
You need to create a meta.php for each module.
The one i posted here is only for Encyclopedia, for the forums, you need to change the queries to the database and so for reviews, FAQ, and every other module you need.
Guido
View user's profile Send private message Visit poster's website MSN Messenger
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Tue Apr 18, 2006 8:49 am Reply with quote Back to top

guidyy wrote:
Correct.
You need to create a meta.php for each module.
The one i posted here is only for Encyclopedia, for the forums, you need to change the queries to the database and so for reviews, FAQ, and every other module you need.
Guido


Thank you so very much... Smile
View user's profile Send private message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Tue Apr 18, 2006 2:53 pm Reply with quote Back to top

guidyy: Any chance that you could post your forum one? I have been toying with this one all day and I am just not getting it right.

Thanks,
View user's profile Send private message
guidyy
Worker
Worker


Joined: Nov 22, 2004
Posts: 208
Location: Italy

PostPosted: Tue Apr 18, 2006 11:02 pm Reply with quote Back to top

i'll try to find it in the "buried" stuff....
View user's profile Send private message Visit poster's website MSN Messenger
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Tue Apr 18, 2006 11:16 pm Reply with quote Back to top

guidyy wrote:
i'll try to find it in the "buried" stuff....


That would be great, thank you. A reviews one also would the iceing on the cake. Smile
View user's profile Send private message
guidyy
Worker
Worker


Joined: Nov 22, 2004
Posts: 208
Location: Italy

PostPosted: Wed Apr 19, 2006 12:30 am Reply with quote Back to top

Ok here it is.
It doesnt work good.
I did not find a way to remove bbcodes, smilies , and other strange things (like ascii art) from the text of a post.
I think this is pretty much useless, but maybe you can find a way to adapt for your needs.

About reviews: I do not have it done.



Code:

<?php

# $Author: chatserv $
# $Date: 2004/11/01 03:56:44 $
/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/



if ( !defined('MODULE_FILE') )
{
   die("You can't access this file directly...");
}
define('INDEX_FILE', true);
global $name;
include ("config.php");
include("db/db.php");

// ---> This generates the desc for module---->   Forums
if($name=="Forums"){
global $p,$t,$forum,$f, $first_post;
$MyNewdesc = "Our forum section ";
    if($p) {
        $sql = "SELECT post_subject, post_id, post_text FROM ".$prefix."_bbposts_text WHERE post_id='$p'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $title = $row[post_subject];  //post subject
        $post = $row[post_id];        //post id
        $text = $row[post_text];      //post text
        $MyNewdesc = "$title: $text";

    }
    if($t) {
        $sql = "SELECT topic_title, topic_first_post_id, forum_id FROM ".$prefix."_bbtopics WHERE topic_id='$t'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $title = $row[topic_title];  //topic title
        $forum = $row[forum_id];     //id of the forum the topic belongs to
        $first_post = $row[topic_first_post_id]; // id of first post in the topic

        $sql = "SELECT forum_name FROM ".$prefix."_bbforums WHERE forum_id='$forum'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $forum = $row[forum_name];  //forum name

        $sql = "SELECT post_subject, post_id, post_text FROM ".$prefix."_bbposts_text WHERE post_id='$first_post'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $post = $row[post_id]; // id of first post  in topic
        $text = $row[post_text]; //text of the first post in topic

    $MyNewdesc= "$title: $text";
    }
    elseif($f) {
        $sql = "SELECT forum_name, forum_desc FROM ".$prefix."_bbforums WHERE forum_id='$f'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $forum = $row[forum_name]; // forum name
        $desc= $row[forum_desc]; //  forum description
        $MyNewdesc = "$forum: $desc";
    }
$db->sql_freeresult($result);}

//here we filter special char
$search = array ("'<s cript[^>]*?>.*?</s cript>'si",
                      "'<[\/\!]*?[^<>]*?>'si",
                      "'([\r\n])[\s]+'",
                      "'&(amp|#38);'i",
                      "'&(lt|#60);'i",
                      "'&(gt|#62);'i",
                      "'&(nbsp|#160);'i",
                      "'&(iexcl|#161);'i",
                      "'&(cent|#162);'i",
                      "'&(pound|#163);'i",
                      "'&(copy|#169);'i",
                      "'&#(\d+);'e"
                      );
$replace = array ( "",
                      "",
                      "\\1",
                      "&",
                      "<",
                      ">",
                      " ",
                      chr(161),
                      chr(162),
                      chr(163),
                      chr(169),
                      "chr(\\1)"
                      );

     $MyNewDesc = preg_replace($search, $replace, $MyNewDesc);


$str = substr($MyNewdesc,0,100);
$str= strip_tags($str);  // here we strip  html tags...  but how to filter BBCODE ascii art and smilies???




##################################################
# Include for Meta Tags generation               #
##################################################
// here we render the metatags
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="._CHARSET."\">\n";
#echo "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">\n";
#echo "<META NAME=\"RESOURCE-TYPE\" CONTENT=\"DOCUMENT\">\n";
echo "<META NAME=\"DISTRIBUTION\" CONTENT=\"GLOBAL\">\n";
echo "<META NAME=\"AUTHOR\" CONTENT=\"Yummyfood\">\n";
echo "<META NAME=\"COPYRIGHT\" CONTENT=\"Copyright (c) 2004 by $sitename\">\n";
echo "<META NAME=\"KEYWORDS\" CONTENT=\"food and wine,  menu ideas, wine cellar, fast meals recipes, security in the kitchen, wine reviews, health and nutrition,  \">\n";
echo "<META NAME=\"DESCRIPTION\" CONTENT=\"$str\">\n";
echo "<META NAME=\"ROBOTS\" CONTENT=\"INDEX, FOLLOW, NOARCHIVE\">\n";
echo "<META NAME=\"REVISIT-AFTER\" CONTENT=\"10 DAYS\">\n";



#echo "<META NAME=\"RATING\" CONTENT=\"GENERAL\">\n";

###############################################
# DO NOT REMOVE THE FOLLOWING COPYRIGHT LINE! #
# YOU'RE NOT ALLOWED TO REMOVE NOR EDIT THIS. #
###############################################

echo "<META NAME=\"GENERATOR\" CONTENT=\"PHP-Nuke $Version_Num - Copyright 2003 by http://phpnuke.org\">\n";
# $Log: meta.php,v $
# Revision 1.1  2004/11/01 03:56:44  chatserv
# Initial CVS Addition
#

?>
View user's profile Send private message Visit poster's website MSN Messenger
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Wed Apr 19, 2006 12:32 am Reply with quote Back to top

I will try it out and let you know how it goes, Thank you!
View user's profile Send private message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Wed Apr 19, 2006 11:38 am Reply with quote Back to top

Ok, it worked wonders! I really like the fact that it does a unique meta description for each post, not just for each topic.
View user's profile Send private message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Tue Apr 25, 2006 9:26 am Reply with quote Back to top

I just wanted to report back on how this is working.

It is great, I have seen a 40% increase in traffic in a very short amount of time. Google is now seeing each forum post, not just each topic, as a page and is listing it in the directory. The bb code being included in some (not many) descriptions is really not an issue for me and far out weighs the benefits of having unique descriptions for each post/topic.

I was wondering if anyone had the code that would do the news (article.php) description meta in a similar fashion (the title and the first 150 characters of text)?
View user's profile Send private message
neo074
New Member
New Member


Joined: Apr 27, 2006
Posts: 1

PostPosted: Thu Apr 27, 2006 2:50 pm Reply with quote Back to top

This idea of having a dynamic description for every page is a good one. The code listed above is for an older version of phpnuke though; I am using version 7.8, does anyone know how to configure this code for this version?
View user's profile Send private message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Thu Apr 27, 2006 3:15 pm Reply with quote Back to top

neo074 wrote:
This idea of having a dynamic description for every page is a good one. The code listed above is for an older version of phpnuke though; I am using version 7.8, does anyone know how to configure this code for this version?


I worked just fine on my 7.9
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Thu Apr 27, 2006 10:18 pm Reply with quote Back to top

Nice idea! I think we could use the same functions in the nukeSEO sitemap to do dynamic descriptions. The question is: would you want to be able to disable that for modules (i.e. don't include this content in the sitemap - regardless of whether or not the module is active and don't include the title in the description).

Also, you might want to check the module description to make sure something is there, and if not, use the standard description.

Finally, you should probably use include_once instead of include.
View user's profile Send private message
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Thu Apr 27, 2006 10:33 pm Reply with quote Back to top

kguske wrote:
Nice idea! I think we could use the same functions in the nukeSEO sitemap to do dynamic descriptions. The question is: would you want to be able to disable that for modules (i.e. don't include this content in the sitemap - regardless of whether or not the module is active and don't include the title in the description).

Also, you might want to check the module description to make sure something is there, and if not, use the standard description.

Finally, you should probably use include_once instead of include.


The bottom line is: Use as much as you can for descriptions. Grab the title first and 200 charactors of text.

I am not sure what you mean about the sitemaps, as I do not include any meta other than Follow, NoIndex in those files.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Fri Apr 28, 2006 4:31 am Reply with quote Back to top

Sorry, that was really more of a note to myself. The nukeSEO sitemap has the ability to use a title for each page of content, so we could use the same functions to get the description.
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Fri Apr 28, 2006 5:37 am Reply with quote Back to top

Any chance the META information for each module can be "managed" in a table as apposed to having potentially many, many module meta.php files in the includes folder? Wink
View user's profile Send private message Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Fri Apr 28, 2006 5:42 am Reply with quote Back to top

Interesting thread.
dconnor - I would be interested to learn what happens over the long term, say a month or two. The increase in traffic you are currently seeing may just be down to the fact that your content has changed (at least from the perspective of the search engine) as they re-crawl and index the changes due to the modifications made.

If you start seeing more visitors from anything other than bots/crawlers/spiders then I would certainly appreciate you confirming that at some point as that would be a good indicator of whether or not the search engines are feeding search results more appropriately.
View user's profile Send private message Send e-mail Visit poster's website
dconnor
New Member
New Member


Joined: Apr 17, 2006
Posts: 19

PostPosted: Fri Apr 28, 2006 8:30 am Reply with quote Back to top

montego wrote:
Any chance the META information for each module can be "managed" in a table as apposed to having potentially many, many module meta.php files in the includes folder? Wink


It would be nice, but I do not know how to do it.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum