Author |
Message |
mrix
Client

Joined: Dec 04, 2004
Posts: 757
|
Posted:
Fri May 20, 2005 7:04 am |
|
Hello I was looking at this forums browser titles for each topic and the title changes in the browser per topic etc which is great! how do you go about doing this as it will help so much in google as opposed to having the same site title per page.
Cheers
mrix |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Fri May 20, 2005 11:39 am |
|
This is accomplished through the Dynamic Titles addon. Search here and/or Google for more information  |
|
|
|
 |
mrix

|
Posted:
Fri May 20, 2005 12:11 pm |
|
Oh its an add on great I`ll take a search around
thanks
mrix |
|
|
|
 |
mrix

|
Posted:
Fri May 20, 2005 12:16 pm |
|
dam every link I seem to click on for this addon in google returns a 404 page, I guess there must be a main site and its down for this addon?
Cheers
mrix |
|
|
|
 |
Raven

|
Posted:
Fri May 20, 2005 3:56 pm |
|
Here is mine. This goes in your includes folder - Save as includes/dynamic_titles.php. Obviously, customize for your site  Code:<?php
/********************************************************************/
/* SN Dynamic Titles Addon */
/* =========================== */
/* Copyright (c) 2003 by Greg Schoper */
/* http://nuke.schoper.net */
/* */
/* Based on code from PHP-Nuke */
/* 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. */
/********************************************************************/
/* Credit to unknown author of original forums code in */
/* includes/dynamic_titles.php. */
/********************************************************************/
if (eregi("dynamic_titles.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.html");
die();
}
$name=ereg_replace("_", " ", "$name");
// Item Delimeter
$item_delim = "";
$newpagetitle = "";
global $name;
include ("config.php");
include("db/db.php");
// Forums
if($name=="Forums"){
global $p,$t,$forum,$f;
$newpagetitle = "$name";
//$newpagetitle = "phpNuke $name";
if($p) {
$sql = "SELECT post_subject, post_id FROM ".$prefix."_bbposts_text WHERE post_id='$p'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$title = $row[post_subject];
$post = $row[post_id];
$newpagetitle = "$title";
}
if($t) {
$sql = "SELECT topic_title, forum_id FROM ".$prefix."_bbtopics WHERE topic_id='$t'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$title = $row[topic_title];
$forum = $row[forum_id];
$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];
$newpagetitle = "$title";
}
elseif($f) {
$sql = "SELECT forum_name FROM ".$prefix."_bbforums WHERE forum_id='$f'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$forum = $row[forum_name];
$newpagetitle = "$forum";
}
}
// News
if($name=="News"){
global $file,$sid,$new_topic;
$newpagetitle= "$item_delim PHP Web Host - Quality Web Hosting For All PHP Applications";
if ($new_topic!=""){
$sql = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$top = $row[topictext];
$newpagetitle= "$top";
}
if ($file=="article"){
$sql = "SELECT title, topic FROM ".$prefix."_stories WHERE sid='$sid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$art = $row[title];
$top = $row[topic];
$sql = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$top'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$top = $row[topictext];
$newpagetitle= "$art";
}
}
// Topics
if($name=="Topics"){
$newpagetitle = "$item_delim "._ACTIVETOPICS."";
}
// Downloads
if($name=="Downloads"){
global $d_op,$cid,$lid;
$newpagetitle = "$item_delim $name";
if($d_op=="viewdownload") {
$sql = "SELECT title, parentid FROM ".$prefix."_downloads_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$parent = $row[parentid];
if($parent=="0"){
$newpagetitle = "$name $cat";
}
else{
$sql = "SELECT title FROM ".$prefix."_downloads_categories WHERE cid='$parent'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$parent = $row[title];
$newpagetitle = "$name $parent $cat";
}
}
if($d_op=="viewdownloaddetails" || $d_op=="getit") {
$sql = "SELECT title FROM ".$prefix."_downloads_downloads WHERE lid='$lid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$dl = $row[title];
$newpagetitle = "$name $dl";
}
}
// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$name=ereg_replace("_", " ", "$name");
$newpagetitle = " $name"; if($l_op=="viewlink") {
$sql = "SELECT title, parentid FROM ".$prefix."_links_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$parent = $row[parentid];
if($parent=="0"){
$newpagetitle = "$name $cat";
}
else{
$sql = "SELECT title FROM ".$prefix."_links_categories WHERE cid='$parent'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$parent = $row[title];
$newpagetitle = "$name $parent $cat";
}
}
}
// Content
if($name=="Content"){
global $pa,$cid,$pid;
$newpagetitle = "$item_delim $name";
if($pa=="list_pages_categories") {
$sql = "SELECT title FROM ".$prefix."_pages_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$newpagetitle = "$name $cat";
}
if($pa=="showpage") {
$sql = "SELECT title, cid FROM ".$prefix."_pages WHERE pid='$pid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$page = $row[title];
$cid = $row[cid];
$sql = "SELECT title FROM ".$prefix."_pages_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$newpagetitle = "$page";
}
}
// Reviews
if($name=="Reviews"){
global $rop,$id;
$newpagetitle = "$name";
if($rop=="showcontent") {
$sql = "SELECT title FROM ".$prefix."_reviews WHERE id='$id'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$rev = $row[title];
$newpagetitle = "$name $rev";
}
}
// Stories Archive
if($name=="Stories_Archive"){
global $sa,$year,$month_l;
$name=ereg_replace("_", " ", "$name");
$newpagetitle = "$name";
if($sa=="show_month") {
$newpagetitle = "$name $month_l, $year";
}
}
// Sections
if($name=="Sections"){
global $op,$secid,$artid;
$newpagetitle = "$item_delim $name";
if($op=="listarticles") {
$sql = "SELECT secname FROM ".$prefix."_sections WHERE secid='$secid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sec = $row[secname];
$newpagetitle = "$name $sec";
}
if($op=="viewarticle") {
$sql = "SELECT title, secid FROM ".$prefix."_seccont WHERE artid='$artid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$art = $row[title];
$cid = $row[secid];
$sql = "SELECT secname FROM ".$prefix."_sections WHERE secid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sec = $row[secname];
$newpagetitle = "$art";
}
}
// Catchall for anything we don't have custom coding for
if($newpagetitle==""){
$name=ereg_replace("_", " ", "$name");
$newpagetitle="$name";
}
// Admin Pages
if(substr($_SERVER['REQUEST_URI'], 0, 10)=="/admin.php"){
$newpagetitle="Administration for RavenPHPScripts.Com";
}
// If we're on the main page let's use our site slogan
if($_SERVER['REQUEST_URI']=="/index.php" || $_SERVER['REQUEST_URI']=="/"){
// $newpagetitle="$slogan";
$newpagetitle = "PHP Web Host - Quality Web Hosting For All PHP Applications.";
}
// We're Done! Place the Title on the page
echo "<title>$newpagetitle</title>\n";
$name=ereg_replace(" ", "_", "$name");
?>
|
Then, in header.php, edit the function head() and modifyCode: echo "<title>$sitename $pagetitle</title>\n";
| toCode:// echo "<title>$sitename $pagetitle</title>\n";
include("includes/dynamic_titles.php");
|
|
|
|
|
 |
mrix

|
Posted:
Sat May 21, 2005 4:36 am |
|
Great many thanks Raven.
Cheers
mrix |
|
|
|
 |
aoratos
New Member


Joined: Jun 07, 2005
Posts: 3
|
Posted:
Tue Jun 07, 2005 7:41 am |
|
can you plz identify what are the parts to be edited according to everyones site?
i have 7.6 currently installed and my site is www.nosaint.gr... it's greek
thanks |
|
|
|
 |
Lucifix
Regular


Joined: Mar 11, 2005
Posts: 67
|
Posted:
Sun Jun 12, 2005 10:20 am |
|
Maybe u can help me.
I inserted your code:
Code:// Forums
if($name=="Forums"){
global $p,$t,$forum,$f;
$newpagetitle = "$name";
//$newpagetitle = "phpNuke $name";
if($p) {
$sql = "SELECT post_subject, post_id FROM ".$prefix."_bbposts_text WHERE post_id='$p'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$title = $row[post_subject];
$post = $row[post_id];
$newpagetitle = "$title";
}
| (this is just part of it)
And I don't get any post object - title on top:
http://www.slo-foto.net/ftopicp-40015.html#40015
But if you click on first post, u'll get it:
http://www.slo-foto.net/ftopicp-40009.html#40009
Do you have any idea what could be wrong? |
|
|
|
 |
DraGoN
New Member


Joined: Oct 25, 2005
Posts: 14
|
Posted:
Sun Nov 13, 2005 10:14 pm |
|
Anyone know what needs to be changed in the code below to get this to work correctly with NSN Group Downloads?
Code:// Downloads
if($name=="Downloads"){
global $d_op,$cid,$lid;
$newpagetitle = "$item_delim $name";
if($d_op=="viewdownload") {
$sql = "SELECT title, parentid FROM ".$prefix."_downloads_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$parent = $row[parentid];
if($parent=="0"){
$newpagetitle = "$name $cat";
}
else{
$sql = "SELECT title FROM ".$prefix."_downloads_categories WHERE cid='$parent'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$parent = $row[title];
$newpagetitle = "$name $parent $cat";
}
}
if($d_op=="viewdownloaddetails" || $d_op=="getit") {
$sql = "SELECT title FROM ".$prefix."_downloads_downloads WHERE lid='$lid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$dl = $row[title];
$newpagetitle = "$name $dl";
}
}
|
I thought it would be as simple as pointing it to the correct Data Base tables but that didnt work.
Thanks for any help. |
|
|
|
 |
Admin32
Regular


Joined: Sep 14, 2003
Posts: 74
|
Posted:
Thu Nov 24, 2005 4:19 pm |
|
I've implemented this great modification and now looking into doing the same for the articles I write.
The article pages are php files with the <title> tags in them, so I'd like to tell dynamic_titles.php to check for these tags and use them.
I've figured that the section required to be modified is the following:
// Catchall for anything we don't have custom coding for
if($newpagetitle==""){
$name=ereg_replace("_", " ", "$name");
$newpagetitle="$name";
}
I'm just trying to figure out what exactly I need to change to get this to work.
Your help is much appreciated! |
_________________ ___________________
Chris Partsenidis
Founder & Senior Editor
www.Firewall.cx
___________________ |
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Fri Dec 16, 2005 7:46 am |
|
DraGoN wrote: | Anyone know what needs to be changed in the code below to get this to work correctly with NSN Group Downloads? |
Try this instead and see if you like it:
Code:
if($name=="Downloads"){
global $d_op,$cid,$lid;
$newpagetitle = "$item_delim $name";
if($cid) {
$sql = "SELECT title, parentid FROM ".$prefix."_nsngd_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$parent = $row[parentid];
if($parent=="0"){
$newpagetitle = "$name $cat";
}
else{
$sql = "SELECT title FROM ".$prefix."_nsngd_categories WHERE cid='$parent'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$parent = $row[title];
$newpagetitle = "$name $parent $cat";
}
}
if($d_op=="getit") {
$sql = "SELECT title FROM ".$prefix."_nsngd_downloads WHERE lid='$lid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$dl = $row[title];
$newpagetitle = "$name $dl";
}
}
|
In reality, I rreally do not like how the variables in this script are not checked for input and intval'd, etc., and I may re-write this to be more GoogleTap'ish to make it really easy for folks to add new "DTs". Some day....
Regards |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
DraGoN

|
Posted:
Fri Dec 16, 2005 5:07 pm |
|
Thanks it works partially which is better than what I could get it to do. It still doesn’t list the downloads name in the title bar when you view the downloads description. |
|
|
|
 |
montego

|
Posted:
Fri Dec 16, 2005 5:21 pm |
|
Yes, I noticed that too, but also noticed that the base Downloads one (for core nuke) did not as well?? I just didn't have time to include it as yet. If I do, I will post it here again. Of course, if you get their first, please post it back here for the general community.
 |
|
|
|
 |
guynuked
Hangin' Around

Joined: Jan 11, 2004
Posts: 37
|
Posted:
Sun Dec 31, 2006 5:58 am |
|
Dang, I love how it does for my Forum titles, but when I use sweetphp.com events calendar, the title for each calendar I created there disappears...
Gosh, how do I start explaining to author of the calendar for the code change suggestion in order to get the code change suggestion? Send him/her link to this topic?
It's a great modification. |
|
|
|
 |
|