![]() |
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 |
Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid"); |
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 |
Replace:
Code:
$page=$post[pagetext]; Code:
$page=iif(strlen($url)>30,substr($post[pagetext],0,30)."..."),$post[pagetext]); Don't know about the vB code stripping though. |
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]); $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 |
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); Code:
$page=bbcodeparse2($codetoparse, $html, $imgcode, $smilies, $vbcode); |
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"); Then I put in just: Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid"); 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 |
Sorry, my bad, use this code:
Code:
$post=$DB_site->query_first("SELECT pagetext FROM post WHERE threadid=$thread[threadid] ORDER BY postid"); And in the bbcodeparse2() call you use 1 or 0 - 1 means it's parsed and 0 means it's not. :) |
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"); Code:
eval("\$forumdisplaybits .= \"".gettemplate('forumdisplaybit')."\";"); Also should that be Code:
,30),"...", instead of ,30)."...", ? If I put a right bracket before the eval line I get a parce code error at line 520. Thanks, Parker |
This code in forumdisplay.php is working great for me, no errors or anything:
Code:
} else { |
All times are GMT. The time now is 03:29 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|