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
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

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

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
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Tue Jan 01, 2008 9:20 pm Reply with quote Back to top

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
View user's profile Send private message
montego
Former Admin in Good Standing


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

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

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!
View user's profile Send private message Visit poster's website
montego
Former Admin in Good Standing


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

PostPosted: Thu Jan 03, 2008 8:40 am Reply with quote Back to top

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.
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 884

PostPosted: Thu Jan 03, 2008 8:13 pm Reply with quote Back to top

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

Dawg
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