Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Dawg
RavenNuke(tm) Development Team



Joined: Nov 07, 2003
Posts: 928

PostPosted: Tue Sep 05, 2006 7:38 pm Reply with quote

Greetings All,
I am looking for a nudge int eh right direction....

I am using Dynamic Titles on my site but I want to change how my Foums show up.

Currently I have

Site Name - Forums - Forum Name - Topic Name

Here is the code I am using....
Code:


// Forums
if($name=="Forums"){
global $p,$t,$forum,$f;
$newpagetitle = "$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 = "$name $item_delim Post $post $item_delim $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 = "$item_delim $name $item_delim $forum $item_delim $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 = "$item_delim $name $item_delim $forum";
    }
}



I want....
Site Name - Forum Catagory - Forum Name - Topic Name

I have tried several different ways but nothing seems to work. A point in the right direction is all I need.

Thank You for your time!

Dawg
 
View user's profile Send private message
montego
Site Admin



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

PostPosted: Tue Sep 05, 2006 10:51 pm Reply with quote

While there are others who would profess that having your actual latest forum post up front as much as possible is even better... this is what storebuilder had suggested long back. "Six" redid DT after that and came up with this instead:

Code:


if($name=="Forums"){
global $p,$t,$forum,$f;
$newpagetitle = "$sitename $item_delim $name"; 
$newpagetitle = preg_replace("/\[(\S+)\]/e", "", $newpagetitle);
$newpagetitle = check_html($newpagetitle, nohtml);
    if($p) {
$p = intval($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 = $row[post_id];
        $ptext = $row[post_text];

        $newpagetitle = "$title $item_delim $ptext";
        $newpagetitle = preg_replace("/\[(\S+)\]/e", "", $newpagetitle);
        $newpagetitle = check_html($newpagetitle, nohtml);
    }
    if($t) {
$t = intval($t);
        $sql = "SELECT topic_first_post_id  FROM ".$prefix."_bbtopics WHERE topic_id='$t'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $tpid = $row[topic_first_post_id ];
         
        $sql = "SELECT post_subject, post_id, post_text FROM ".$prefix."_bbposts_text WHERE post_id='$tpid'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $title = $row[post_subject];
        $post = $row[post_id];
        $ptext = $row[post_text];

        $newpagetitle = "$title $item_delim $ptext";
        $newpagetitle = preg_replace("/\[(\S+)\]/e", "", $newpagetitle);
        $newpagetitle = check_html($newpagetitle, nohtml);
    }
    elseif($f) {
$f = intval($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 = "$sitename $item_delim $forum";
        $newpagetitle = preg_replace("/\[(\S+)\]/e", "", $newpagetitle);
        $newpagetitle = check_html($newpagetitle, nohtml);
    }
}


But, I think the way this works is the "p" stands for if the user had actually clicked into a post, so its at the "lowest level" in phpBB. The "t" stands for if they had clicked into an actual Topic. The "f" is for if they just clicked on the overall Forum. I do not know this for certain, but I suspect that "c" would be if they had clicked on a Forum category (if you wanted to add that level).

So, you would need to consider each of the first three and possibly the additonal one as to what fields make sense at each level.

_________________
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! 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©