Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives

Reply
 
Thread Tools
Details »»

Version: , by Parker Clack Parker Clack is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 12-07-2001 Last Update: Never Installs: 0
 
No support by the author.

I am wanting to call up the first post in a thread using the pagetext information in the post table. What would I use as a database query so that I get the pagetext associated with the first post in a thread?

I am wanting to use this in the forumdisplay.php file right before the call to the forumdisplaybit template.

I have tried using:

$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid]");
$page=post[pagetext];

But I get varied results and it is is not the first post associated with the threadid.

Any ideas?

Thanks,
Parker

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 12-07-2001, 02:43 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid");
Reply With Quote
  #3  
Old 12-07-2001, 10:16 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Chen:

Thanks. That worked like a champ.

Now what would I use to keep the pagetext information limted to the first 30 characters followed by a ....? Is there a code to strip the vbcode and HTML code in the pagetext information? I would prefer to keep the vB code and HTML out of the information that is displayed.

Thanks,
Parker
Reply With Quote
  #4  
Old 12-08-2001, 07:57 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Replace:
Code:
$page=$post[pagetext];
With:
Code:
$page=iif(strlen($url)>30,substr($post[pagetext],0,30)."..."),$post[pagetext]);
to only show first 30 chars followed by '...'.

Don't know about the vB code stripping though.
Reply With Quote
  #5  
Old 12-08-2001, 08:27 AM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Instead of striping the vBcode would you use the bbcodeparse2 or bbcodeparse?

So you could have:

Code:
$page=iif(strlen($url)>30,substr($post[pagetext],0,30)."..."),$post[pagetext]);
followed by

$page2=bbcodeparse[$page];

or

$page2=bbcodeparse2[$page];

Do you think that would work ok?

What would you have to use if you wanted to parse the html in the pagetext then?

Parker
Reply With Quote
  #6  
Old 12-08-2001, 08:47 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you parse vB code, the output will simply have the equal HTML code.
For example, [color=red]text[/color] will be converted to <font color="red">text</font>.

Up to you.
To convert the text, use this:
Code:
$page=bbcodeparse2($page,1,1,1,1);
The 1 numbers are in this order:
Code:
$page=bbcodeparse2($codetoparse, $html, $imgcode, $smilies, $vbcode);
Reply With Quote
  #7  
Old 12-08-2001, 12:03 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Chen:

Ok, bare with me a little more.

I put in:

Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid");
$page=iif(strlen($url)>30,substr($post[pagetext],0,30)."..."),$post[pagetext]);
$page=bbcodeparse2($page,1,1,1,1);
and got a parse error:

Then I put in just:

Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid");
$page=iif(strlen($url)>30,substr($post[pagetext],0,30)."..."),$post[pagetext]);
and also got a parse error.

So is $url supposed to be that or something else like $thread[threadid]. I mean where do the $url come from?

Also, is the bbcodeparse2 suppsed to have the numbers or
the $html, $vbcode, etc.?

Thanks again,
Parker
Reply With Quote
  #8  
Old 12-08-2001, 12:11 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, my bad, use this code:
Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid");
$page=iif(strlen($post[pagetext])>30,substr($post[pagetext],0,30)."...",$post[pagetext]);
$page=bbcodeparse2($page,1,1,1,1);
(misplaced a parenthesis)

And in the bbcodeparse2() call you use 1 or 0 - 1 means it's parsed and 0 means it's not.
Reply With Quote
  #9  
Old 12-08-2001, 01:08 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry Chen it is still giving me a parse code error.

In forumdisplay.php I am putting:


Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid");
$page=iif(strlen($post[pagetext])>30,substr($post[pagetext],0,30)."...",$post[pagetext]);
$page=bbcodeparse2($page,1,1,1,1);
right above:


Code:
eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";");

}
and getting a parse code error at line 527.

Also should that be

Code:
,30),"...", instead of ,30)."...",  ?
Parker


If I put a right bracket before the eval line I get a parce code error at line 520.

Thanks,
Parker
Reply With Quote
  #10  
Old 12-08-2001, 01:35 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This code in forumdisplay.php is working great for me, no errors or anything:
Code:
    } else {
	     $backcolor = '{firstaltcolor}';
		 $bgclass = "alt1";
    }
    $post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid");
    $page=iif(strlen($post[pagetext])>30,substr($post[pagetext],0,30)."...",$post[pagetext]);
    $page=bbcodeparse2($page,1,1,1,1);
    eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";");

  }
  $DB_site->free_result($threads);
Reply With Quote
Reply

Thread Tools

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 02:53 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.05218 seconds
  • Memory Usage 2,293KB
  • Queries Executed 25 (?)
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
  • (13)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)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
  • (9)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