Ravens PHP Scripts: Forums
 

 

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


Joined: Nov 07, 2003
Posts: 910

PostPosted: Tue Jan 01, 2008 9:00 pm Reply with quote

Greetings All,
I am about to complete my recent upgrade of my main site to RN. I have hit a snag in DynamicTitles for the forums.

Becasue of the way I do page headers and footers I need to do something else in the forums. I have messed with it and gotten no where....

This is the existing DT
Code:
if ($name == 'Forums') {

   global $p, $t, $f, $c;
   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);
      $asDTText['subject'] = $row['post_subject'];
      $asDTText['text'] = substr($row['post_text'], 0, $text_size);
      if (empty($asDTText['subject'])) {
         $sql = 'SELECT topic_id FROM '.$prefix.'_bbposts WHERE post_id = \''.$p.'\'';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $sql = 'SELECT post_subject FROM '.$prefix.'_bbposts_text a, '.$prefix.'_bbposts b '
            .'WHERE a.post_id = b.post_id AND b.topic_id = \''.intval($row['topic_id']).'\' AND post_subject != \'\' '
            .'AND a.post_id < \''.$p.'\' ORDER BY a.post_id DESC LIMIT 1';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $asDTText['subject'] = $row['post_subject'];
      }
      $newpagetitle = $asDTText['subject'].$dt_delim.$asDTText['text'];
   } elseif ($t) {
      $sql = 'SELECT topic_first_post_id  FROM '.$prefix.'_bbtopics WHERE topic_id=\''.intval($t).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $sql = 'SELECT post_subject, post_id, post_text FROM '.$prefix.'_bbposts_text WHERE post_id=\''.intval($row['topic_first_post_id']).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['subject'] = $row['post_subject'];
      $asDTText['text'] = substr($row['post_text'], 0, $text_size);
      $newpagetitle = $asDTText['subject'].$dt_delim.$asDTText['text'];
   } elseif ($c) {
      $sql = 'SELECT cat_title FROM '.$prefix.'_bbcategories WHERE cat_id=\''.intval($c).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $row['cat_title'].$dt_delim.$sitename;
   } elseif ($f) {
      $sql = 'SELECT forum_name FROM '.$prefix.'_bbforums WHERE forum_id=\''.intval($f).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $row['forum_name'].$dt_delim.$sitename;
   }
}


What I am looking for is a user defined blurb...then the Forum Name and Post title.

$dawg - Forum Name - Post Title

I don't expect anyone to write the code for me...but a push in the right direction is a Happy Thang!

Dawg
 
View user's profile Send private message
Dawg
PostPosted: Tue Jan 01, 2008 9:20 pm Reply with quote

This is as far as I got with it....
$main is my blurb....
Code:
if ($name == 'Forums') {

   global $p, $t, $f, $c;
   
   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);
      $asDTText['subject'] = $row['post_subject'];
      $asDTText['text'] = substr($row['post_text'], 0, $text_size);
      //Subject
      if (empty($asDTText['subject'])) {
         $sql = 'SELECT topic_id FROM '.$prefix.'_bbposts WHERE post_id = \''.$p.'\'';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $sql = 'SELECT post_subject FROM '.$prefix.'_bbposts_text a, '.$prefix.'_bbposts b '
            .'WHERE a.post_id = b.post_id AND b.topic_id = \''.intval($row['topic_id']).'\' AND post_subject != \'\' '
            .'AND a.post_id < \''.$p.'\' ORDER BY a.post_id DESC LIMIT 1';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $asDTText['subject'] = $row['post_subject'];
      }
      $newpagetitle = $main.$dt_delim.$asDTText['subject'];
   } elseif ($t) {
   //Subject Text
      $sql = 'SELECT topic_first_post_id  FROM '.$prefix.'_bbtopics WHERE topic_id=\''.intval($t).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $sql = 'SELECT post_subject, post_id, post_text FROM '.$prefix.'_bbposts_text WHERE post_id=\''.intval($row['topic_first_post_id']).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['subject'] = $row['post_subject'];
      $asDTText['text'] = substr($row['post_text'], 0, $text_size);
      $newpagetitle = $main.$dt_delim.$asDTText['subject'].$dt_delim.$asDTText['text'];
   } elseif ($c) {
   //Cat Name
      $sql = 'SELECT cat_title FROM '.$prefix.'_bbcategories WHERE cat_id=\''.intval($c).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $main.$dt_delim.$row['cat_title'].$dt_delim.$sitename;
   } elseif ($f) {
   //Forum Name
      $sql = 'SELECT forum_name FROM '.$prefix.'_bbforums WHERE forum_id=\''.intval($f).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $main.$dt_delim.$row['forum_name'];
   }
}


The main forum itself works right....Blurb - Forum
The individual forum works right....Blurb - Forum Name
It is the post thjat I am having trouble with....
What I have is Blurb - Post
What I want is Blurb - Forum Name - Post
 
montego
Site Admin


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

PostPosted: Thu Jan 03, 2008 8:39 am Reply with quote

Dawg, this has not been tested, but maybe something like this:

Code:


if ($name == 'Forums') {
   global $p, $t, $f, $c;

   if ($p) {
      $p = intval($p);

      $sql = 'SELECT post_subject, post_id, post_text, forum_name FROM '.$prefix.'_bbposts_text a, '
         .$prefix.'_bbposts b, '.$prefix.'_bbforums c WHERE post_id=\''.$p.'\' AND a.post_id = b.post_id '
         .'AND b.forum_id = c.forum_id';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['subject'] = $row['post_subject'];
      $asDTText['text'] = substr($row['post_text'], 0, $text_size);
      $asDTText['forum_name'] = $row['forum_name'];
      //Subject
      if (empty($asDTText['subject'])) {
         $sql = 'SELECT topic_id FROM '.$prefix.'_bbposts WHERE post_id = \''.$p.'\'';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $sql = 'SELECT post_subject FROM '.$prefix.'_bbposts_text a, '.$prefix.'_bbposts b '
            .'WHERE a.post_id = b.post_id AND b.topic_id = \''.intval($row['topic_id']).'\' AND post_subject != \'\' '
            .'AND a.post_id < \''.$p.'\' ORDER BY a.post_id DESC LIMIT 1';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $asDTText['subject'] = $row['post_subject'];
      }
      $newpagetitle = $main.$dt_delim.$asDTText['forum_name'].$dt_delim.$asDTText['subject'];
   } elseif ($t) {
   //Subject Text
      $sql = 'SELECT topic_first_post_id  FROM '.$prefix.'_bbtopics WHERE topic_id=\''.intval($t).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $sql = 'SELECT post_subject, post_id, post_text FROM '.$prefix.'_bbposts_text WHERE post_id=\''.intval($row['topic_first_post_id']).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['subject'] = $row['post_subject'];
      $asDTText['text'] = substr($row['post_text'], 0, $text_size);
      $newpagetitle = $main.$dt_delim.$asDTText['subject'].$dt_delim.$asDTText['text'];
   } elseif ($c) {
   //Cat Name
      $sql = 'SELECT cat_title FROM '.$prefix.'_bbcategories WHERE cat_id=\''.intval($c).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $main.$dt_delim.$row['cat_title'].$dt_delim.$sitename;
   } elseif ($f) {
   //Forum Name
      $sql = 'SELECT forum_name FROM '.$prefix.'_bbforums WHERE forum_id=\''.intval($f).'\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $newpagetitle = $main.$dt_delim.$row['forum_name'];
   }
}


Hope this works!

_________________
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
montego
PostPosted: Thu Jan 03, 2008 8:40 am Reply with quote

BTW, there is a newer version of Dynamic Titles out, but it will also come in the RN 2.20.00 release... I have changed it up quite a bit to where you might want to take the 1.2.0 version instead of what you have as a base, but the code change should be similar in terms of getting the forum_name.
 
Dawg
PostPosted: Thu Jan 03, 2008 8:13 pm Reply with quote

Thank You for the help Montego, I will try it out tonight.

Dawg
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> ShortLinks/TegoNuke

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 ©