Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.3 RN Issues
Author Message
Dawg
RavenNuke(tm) Development Team



Joined: Nov 07, 2003
Posts: 928

PostPosted: Fri Jun 19, 2009 7:00 am Reply with quote

I wanted a full Crumb Trail for the apge titles so I did this to Dynamic Titles.

I "Think" I got it right....it works as expected....LOL!

One Consideration....
I use the $var $name for some other uses....You can leave it or you can or change it to newpagetitle which ever you wish....

At the Top of /includes/Dynamic_Titles.php
add...
]
Code:
$main = 'Change This to your Default Forum Name';  //Set Main Forum Name


Code:
// Forums

//This will give a full crumbtrail until cut off by $dt_iTextSize
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'] = $row['post_text'];
      $sql = 'SELECT forum_name FROM ' . $prefix . '_bbforums WHERE forum_id=\'' . intval($p) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['title'] = $row['forum_name'];
      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);
         $dt_topic_id = intval($row['topic_id']);
         $sql = 'SELECT post_subject FROM ' . $prefix . '_bbposts_text a, ' . $prefix . '_bbposts b '
            . 'WHERE a.post_id = b.post_id AND b.topic_id = \'' . $dt_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'];
      }
      if (empty($asDTText['subject'])) { // If we're still empty, we need to go after the thread (topic) title
         $sql = 'SELECT topic_title  FROM ' . $prefix . '_bbtopics WHERE topic_id=\'' . $dt_topic_id . '\'';
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $asDTText['subject'] = $row['topic_title'];
      }
   $name  = $main . $dt_sDelim . $asDTText['title'] . $dt_sDelim . $asDTText['subject'] . $dt_sDelim . $asDTText['text'];
    $newpagetitle = "$name";
   } elseif ($t) {
      $sql = 'SELECT topic_first_post_id, topic_title  FROM ' . $prefix . '_bbtopics WHERE topic_id=\'' . intval($t) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['title'] = $row['topic_title'];
      $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'] = (empty($row['post_subject'])) ? $asDTText['title'] : $row['post_subject'];
      $asDTText['text'] = $row['post_text'];
      $sql = 'SELECT forum_name FROM ' . $prefix . '_bbforums WHERE forum_id=\'' . intval($t) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $asDTText['title'] = $row['forum_name'];
      $name = $main . $dt_sDelim . $asDTText['title'] . $dt_sDelim . $asDTText['subject'] . $dt_sDelim . $asDTText['text'];

   $newpagetitle = "$name";
   } 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 = $main . $dt_sDelim . $row['cat_title'];
   } elseif ($f) {
      $sql = 'SELECT forum_name FROM ' . $prefix . '_bbforums WHERE forum_id=\'' . intval($f) . '\'';
      $result = $db->sql_query($sql);
      $row = $db->sql_fetchrow($result);
      $name = $main . $dt_sDelim . $row['forum_name'];
   $newpagetitle = "$name";
   }
   if ($dt_bUseBBCensor) {
      $dt_orig_word = array();
      $dt_replacement_word = array();
      $sql = 'SELECT word, replacement FROM ' . $prefix . '_bbwords';
      $result = $db->sql_query($sql);
      while ($row = $db->sql_fetchrow($result)) {;
         $dt_orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
         $dt_replacement_word[] = $row['replacement'];
      }
      $name = preg_replace($dt_orig_word, $dt_replacement_word, $newpagetitle);
   $newpagetitle = "$name";
   }
}
 
View user's profile Send private message
Dawg







PostPosted: Fri Jun 19, 2009 9:49 am Reply with quote

I missed the default name other than to reset it in Modules->admin and I bet there is a better way of doing this....So Please educate me

but this works....

Go to the very bottom just before the forum closing bracket and put this...

Code:
   if($name=="Forum"){ 

    $name = "$main";
    $newpagetitle = "$name";
   }


Like I said....I am sure there is a better way.

Dawg
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.3 RN Issues

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 ©