Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-22-2009, 05:59 PM
enteha enteha is offline
 
Join Date: Dec 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default prefix_rich in front of threads

Hi, I am trying to modify a php file that is about latest thread and post scrolling. This file as ready to use but I want to add an ability to show prefix name at the start os thread.I don`t know what variable control prefix rich.can anybody help me? the php file I said is here:

PHP Code:
<?php
/
// ######################### REQUIRE BACK-END ############################
require_once('./includes/config.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
echo"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";

$forum_path "."// Change this to reflect to your forum's Path.
$specific_forum_id ""// If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_a ""// If you dont wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_b "";
$ignore_forum_id_c "";
$ignore_forum_id_d "";
$ignore_forum_id_e "";
$ignore_forum_id_f "";
$ignore_forum_id_g "";
$ignore_forum_id_h "";
$lastpost_limit "20"// Number of posts displayed.
$title_color "#006600"// This is the color of the title.
$text_color "#CC3300"// This is the color of the bottom text.
$title_limit "100"// This is the character limit.
echo"<marquee onmouseover=this.stop() onmouseout=this.start() dir=\"rtl\" direction=\"up\" scrollAmount=\"2\" scrolldelay=\"50\">";
echo 
"<table dir=\"rtl\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
$sforumid '';
$iforumida '';
$iforumidb '';
$iforumidc '';
$iforumidd '';
$iforumide '';
$iforumidf '';
$iforumidg '';
$iforumidh '';
if (
$specific_forum_id) {
    
$sforumid "AND forumid = $specific_forum_id";
}
if (
$ignore_forum_id_a) {
    
$iforumida "AND forumid != $ignore_forum_id_a";
}
if (
$ignore_forum_id_b) {
    
$iforumidb "AND forumid != $ignore_forum_id_b";
}
if (
$ignore_forum_id_c) {
    
$iforumidc "AND forumid != $ignore_forum_id_c";
}
if (
$ignore_forum_id_d) {
    
$iforumidd "AND forumid != $ignore_forum_id_d";
}
if (
$ignore_forum_id_e) {
    
$iforumide "AND forumid != $ignore_forum_id_e";
}
if (
$ignore_forum_id_f) {
    
$iforumidf "AND forumid != $ignore_forum_id_f";
}
if (
$ignore_forum_id_g) {
    
$iforumidg "AND forumid != $ignore_forum_id_g";
}
if (
$ignore_forum_id_h) {
    
$iforumidh "AND forumid != $ignore_forum_id_h";
}
if (
$lastpost_limit) {
    
$lastpost_limited "LIMIT $lastpost_limit";
}
        
//dtabase connection
$server $config['MasterServer']['servername'];
$databaseuser $config['MasterServer']['username'];
$databasepass $config['MasterServer']['password'];
$databasename $config['Database']['dbname'];
$table_prefix $config['Database']['tableprefix'];
$conn mysql_connect("$server""$databaseuser""$databasepass") or die ('database error');
mysql_select_db("$databasename"$conn) or die ('database error');
        
//thread table sql query
$thread_sql_query mysql_query("SELECT threadid,title,lastpost,lastposter,forumid,postusername,lastpostid FROM " $table_prefix "thread WHERE visible=1 AND open=1 $sforumid $iforumida $iforumidb $iforumidc $iforumidd $iforumide $iforumidf $iforumidg $iforumidh ORDER BY lastpost DESC $lastpost_limited");
while(
$thread_get_info mysql_fetch_array($thread_sql_query))
{
    
$lastpost $thread_get_info['lastpost'];
    
$lastposter $thread_get_info['lastposter'];
    
$threadid $thread_get_info['threadid'];
    
$forumid $thread_get_info['forumid'];
    
$postusername $thread_get_info['postusername'];
    
$lastpostid $thread_get_info['lastpostid'];
    
$date date ("m/d/y h:i A" ,$lastpost);
    
$threadtitle $thread_get_info['title'];
    
$threadtitle substr($threadtitle,0,$title_limit);
    
        
//forum table sql query
    
$forum_sql mysql_query("SELECT title FROM " $table_prefix "forum WHERE forumid=$forumid");
    
$forum_get mysql_fetch_array($forum_sql);
    
$forumtitle $forum_get['title'];
    
        
//post table sql query
    
$post_sql mysql_query("SELECT title,postid FROM " $table_prefix "post WHERE postid=$lastpostid");
    
$post_get mysql_fetch_array($post_sql);
    
$lastposterid $post_get['postid'];
    
$lastposttitle $post_get['title'];
    if (empty(
$lastposttitle)) {
        
$lastposttitle = ("response: $threadtitle");    
    }
    
$lastposttitle substr($lastposttitle,0,$title_limit);
    echo 
"<tr dir=\"rtl\"><td dir=\"rtl\"><font size=\"2\" face=\"utf-8\"><a target=_blank href=\"$forum_path/showthread.php?p=$lastposterid#post$lastposterid\"><FONT SIZE=\"4\" COLOR=\"$title_color\" face=\"tahoma\">$threadtitle</FONT></a></font><br> <font color=\"$text_color\" face=\"tahoma\" size='2'>Starter : $postusername |forum :  $forumtitle | last post :  $lastposter </FONT></td></tr>";
}
echo 
"</table>";
echo
"</marquee>";
/*======================================================================*\
|| ##################################################################### ||
|| ############################ END SCRIPT ############################# ||
|| ##################################################################### ||
\*======================================================================*/

I knew that I should write a line such:

$threadtitle = $thread_get_info['title'];

but I don`t know how?
Reply With Quote
  #2  
Old 05-22-2009, 06:22 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Include grabbing the prefixid from the thread table in your query. Then in your while statement:
PHP Code:
                if ($thread_get_info['prefixid']) 
                { 
                    
$thread_get_info['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$thread_get_info[prefixid]_title_plain"]); 
                    
$thread_get_info['prefix_rich'] = $vbphrase["prefix_$thread_get_info[prefixid]_title_rich"]; 
                } 
                else 
                { 
                    
$thread_get_info['prefix_plain_html'] = ''
                    
$thread_get_info['prefix_rich'] = ''
                } 
If you don't want the plain html one, then you may remove those lines.
Reply With Quote
  #3  
Old 05-23-2009, 09:38 AM
enteha enteha is offline
 
Join Date: Dec 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tahnk you Lynne, I added this code to php file but I got errors and didn`t work I have alittle understanding about php. can you make it easier?
Reply With Quote
  #4  
Old 05-23-2009, 03:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Without seeing exactly what you've done, and knowing what the exact errors were, I can't really help.
Reply With Quote
  #5  
Old 05-24-2009, 09:19 AM
enteha enteha is offline
 
Join Date: Dec 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I said that I have a little understanding about php and I want to make a marquee scroller included latest tapics at the top of the board (see: here). I found this one and I decided to make some modifying to show thread`s prefixes in title and then I need some helps.
Reply With Quote
  #6  
Old 05-24-2009, 02:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know. But, I gave you some code and you said you added the code to the file and got errors. So, can you post the file again with the added code so I can see if you added it correctly. And, can you post what the errors were that you got.
Reply With Quote
  #7  
Old 05-25-2009, 10:19 AM
enteha enteha is offline
 
Join Date: Dec 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tahnx for help and supporting. I change php file as this:

PHP Code:
<?php
// ######################### REQUIRE BACK-END ############################
require_once('./includes/config.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
echo"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";

$forum_path "."// Change this to reflect to your forum's Path.
$specific_forum_id ""// If you wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_a ""// If you dont wish to display the posts from a specific forum, enter the forum id here. Otherwise, leave it blank.
$ignore_forum_id_b "536";
$ignore_forum_id_c "";
$ignore_forum_id_d "";
$ignore_forum_id_e "";
$ignore_forum_id_f "";
$ignore_forum_id_g "";
$ignore_forum_id_h "";
$lastpost_limit "20"// Number of posts displayed.
$title_color "#0079c3"// This is the color of the title.
$text_color "#C11B17"// This is the color of the bottom text.
$title_limit "160"// This is the character limit.
echo"<marquee onmouseover=this.stop() onmouseout=this.start() dir=\"rtl\" direction=\"up\" scrollAmount=\"2\" scrolldelay=\"50\">";
echo 
"<table dir=\"rtl\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
$sforumid '';
$iforumida '';
$iforumidb '';
$iforumidc '';
$iforumidd '';
$iforumide '';
$iforumidf '';
$iforumidg '';
$iforumidh '';
if (
$specific_forum_id) {
    
$sforumid "AND forumid = $specific_forum_id";
}
if (
$ignore_forum_id_a) {
    
$iforumida "AND forumid != $ignore_forum_id_a";
}
if (
$ignore_forum_id_b) {
    
$iforumidb "AND forumid != $ignore_forum_id_b";
}
if (
$ignore_forum_id_c) {
    
$iforumidc "AND forumid != $ignore_forum_id_c";
}
if (
$ignore_forum_id_d) {
    
$iforumidd "AND forumid != $ignore_forum_id_d";
}
if (
$ignore_forum_id_e) {
    
$iforumide "AND forumid != $ignore_forum_id_e";
}
if (
$ignore_forum_id_f) {
    
$iforumidf "AND forumid != $ignore_forum_id_f";
}
if (
$ignore_forum_id_g) {
    
$iforumidg "AND forumid != $ignore_forum_id_g";
}
if (
$ignore_forum_id_h) {
    
$iforumidh "AND forumid != $ignore_forum_id_h";
}
if (
$lastpost_limit) {
    
$lastpost_limited "LIMIT $lastpost_limit";
}
        
//dtabase connection
$server $config['MasterServer']['servername'];
$databaseuser $config['MasterServer']['username'];
$databasepass $config['MasterServer']['password'];
$databasename $config['Database']['dbname'];
$table_prefix $config['Database']['tableprefix'];
$conn mysql_connect("$server""$databaseuser""$databasepass") or die ('database error');
mysql_select_db("$databasename"$conn) or die ('database error');
        
//thread table sql query
$thread_sql_query mysql_query("SELECT threadid,title,lastpost,lastposter,forumid,postusername,lastpostid,replycount,views,prefixid,prefix_plain_html FROM " $table_prefix "thread WHERE visible=1 AND open=1 $sforumid $iforumida $iforumidb $iforumidc $iforumidd $iforumide $iforumidf $iforumidg $iforumidh ORDER BY lastpost DESC $lastpost_limited");
while(
$thread_get_info mysql_fetch_array($thread_sql_query))
{
    
$lastpost $thread_get_info['lastpost'];
    
$lastposter $thread_get_info['lastposter'];
    
$threadid $thread_get_info['threadid'];
    
$forumid $thread_get_info['forumid'];
    
$postusername $thread_get_info['postusername'];
    
$lastpostid $thread_get_info['lastpostid'];
    
$date date ("m/d/y h:i A" ,$lastpost);
    
$threadtitle $thread_get_info['title'];
    
$threadtitle substr($threadtitle,0,$title_limit);
    
$replycount $thread_get_info['replycount'];
    
$views $thread_get_info['views'];
                if (
$thread_get_info['prefixid']) 
                { 
                    
$thread_get_info['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$thread_get_info[prefixid]_title_plain"]); 
                    
$thread_get_info['prefix_rich'] = $vbphrase["prefix_$thread_get_info[prefixid]_title_rich"]; 
                } 
                else 
                { 
                    
$thread_get_info['prefix_plain_html'] = ''
                    
$thread_get_info['prefix_rich'] = ''
                } 
    
        
//forum table sql query
    
$forum_sql mysql_query("SELECT title FROM " $table_prefix "forum WHERE forumid=$forumid");
    
$forum_get mysql_fetch_array($forum_sql);
    
$forumtitle $forum_get['title'];
    
        
//post table sql query
    
$post_sql mysql_query("SELECT title,postid FROM " $table_prefix "post WHERE postid=$lastpostid");
    
$post_get mysql_fetch_array($post_sql);
    
$lastposterid $post_get['postid'];
    
$lastposttitle $post_get['title'];
    if (empty(
$lastposttitle)) {
        
$lastposttitle = ("?™¾?˜§?˜³?˜®: $threadtitle");    
    }
    
$lastposttitle substr($lastposttitle,0,$title_limit);
    echo 
"<tr dir=\"rtl\"><td dir=\"rtl\"><font size=\"2\" face=\"utf-8\"><a target=_blank href=\"$forum_path/showthread.php?p=$lastposterid#post$lastposterid\"><FONT SIZE=\"4\" COLOR=\"$title_color\" face=\"tahoma\">$threadtitle</FONT></a></font><br> <font color=\"$text_color\" face=\"tahoma\" size='2'>ا?Œجاد ک?†?†د?‡ ?…?ˆض?ˆع: $postusername | تا?„ار :  $forumtitle | بازد?Œد :  $prefix_plain_html | پاسخ :  $replycount | آخر?Œ?† ارسا?„: $lastposter</FONT></td></tr>";
}
echo 
"</table>";
echo
"</marquee>";
/*======================================================================*\
|| ##################################################################### ||
|| ############################ END SCRIPT ############################# ||
|| ##################################################################### ||
\*======================================================================*/
and got this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /[root address]/forums/latest_posts2.php on line 83
Reply With Quote
  #8  
Old 05-25-2009, 03:57 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is no "prefix_plain_html" field in the thread table, so I'm not sure why you included that. Take it out and see if the error goes away.
Reply With Quote
  #9  
Old 05-26-2009, 12:24 PM
enteha enteha is offline
 
Join Date: Dec 2008
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, I removed that part and now I got this error:

Fatal error: Call to undefined function htmlspecialchars_uni() in /[root address]/forums/latest_posts2.php on line 98
Reply With Quote
  #10  
Old 05-26-2009, 01:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That function is in the file includes/class_core.php so you'll need to either include the file in your plugin (require_once etc.) or copy the function into your page.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06692 seconds
  • Memory Usage 2,364KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete