Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-01-2005, 11:04 PM
TheWolverine TheWolverine is offline
 
Join Date: Mar 2003
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Displaying Posts Stored In Database

Hi all,

I'm currently writing a front-end website to accompany my forums and I've hit a metaphorical brick wall. The problem is that posts that are created using vBulletin when stored in the db don't contain the html formatting tags, in particular for paragraphing. I've searched through the source files to see how vBulletin goes about reading these posts from the db and converting them correctly with all the paragraphs intact but I can't for the life of me figure out how it's done. Basically instead of there being <p> or <br /> tags stored along with the posts in the db there are simply lines in between the text. I don't know how to parse this though into paragraphs when I display the posts on the website though in HTML. Here's an example article of how it's stored in the db in case you don't know what I'm on about:

Code:
This is the fifth and final article I am posting right now for testing purposes. What should happen is that all of the 5 articles that have been posted should appear on the website with the alternating colour scheme working as well. I haven't tested the length of an article yet, but I've got to somehow only post a certain number of words of the article so that the layout isn't messed up.
 
This is the fifth and final article I am posting right now for testing purposes. What should happen is that all of the 5 articles that have been posted should appear on the website with the alternating colour scheme working as well. I haven't tested the length of an article yet, but I've got to somehow only post a certain number of words of the article so that the layout isn't messed up.
This is exactly how it is stored in my database now. My problem is parsing the test as two separate paragraphs. When I retreive the data from the db it grabs it as continuous text and I don't know what the delimitation is between the two paragraphs that I could use to split them up. I hope that's clear enough. Bit difficult to explain. The only way it's working now is if the article is for instance entered originally with the HTML formatting included i.e.

Code:
This is the fifth and final article I am posting right now for testing purposes. What should happen is that all of the 5 articles that have been posted should appear on the website with the alternating colour scheme working as well. I haven't tested the length of an article yet, but I've got to somehow only post a certain number of words of the article so that the layout isn't messed up.
<br /><br /> 
This is the fifth and final article I am posting right now for testing purposes. What should happen is that all of the 5 articles that have been posted should appear on the website with the alternating colour scheme working as well. I haven't tested the length of an article yet, but I've got to somehow only post a certain number of words of the article so that the layout isn't messed up.
Since this formatting is done by vBulletin when the user enters the post in the editor I don't know what to take as the reference point to differentiate between the different paragraphs.

Anyhow assistance would be helpful. I'm still fairly new to vB so go easy on me

Thanks in advance

The Wolverine
Reply With Quote
  #2  
Old 01-01-2005, 11:45 PM
darnoldy darnoldy is offline
 
Join Date: Dec 2004
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheWolverine
I don't know how to parse this though into paragraphs when I display the posts on the website though in HTML.
Those lines *should be* produced produced by either carriage returns or "carriage reurn/line feed" pairs. You can search on those. As I remember, they are ascii 10 & 13. If you have a text editor that will display white space characters, you should be able to check.

--don
Reply With Quote
  #3  
Old 01-02-2005, 08:26 AM
TheWolverine TheWolverine is offline
 
Join Date: Mar 2003
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ummmm so how would I do a string search for those characters? Cause when I query the db to extract the post as follows and echo the contents of the articlepost table entry it just shows continuous text:

PHP Code:
$query_article_table "SELECT postusername, postbody, posttitle, postdateline, sportscatid FROM articlepost, article WHERE postid=".$postid;
$query_article mysql_query($query_article_table$onesports);
$article mysql_fetch_object($query_article);
$username $article->postusername;
$postbody $article->postbody;
$title $article->posttitle;
$dateline $article->postdateline;
$sportscat $article->sportscatid;
echo 
$postbody
Resulting in:

Quote:
Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. [right1]Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.[/right1] [center1][b1]Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.[/b1][/center1]
To indicate where there are paragraphs since it's a little hard to spot I added the dummy text formatting tags [right1] and [center1]. As you can see there should be a new paragraph going from [/right1] to [center1] for instance but there is simply a normal blank space between these two tags, just like between any of the words. My problem is I don't know how to delimit the text so that I can somehow split the echoed text back into its original paragraphs.

For reference sake this is how the paragraphs should look like, like I entered them through the forum:

Quote:
Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.

Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.

Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.

Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum. Lorem ipsum. Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.Lorem ipsum.
This is directly copy-pasted from the showthread.php parsing.

The Wolverine
Reply With Quote
  #4  
Old 01-03-2005, 09:38 AM
TheWolverine TheWolverine is offline
 
Join Date: Mar 2003
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No one with a suggestion? It looks like that only text formatting where no tag is added is for paragraphs. Everything else tags are added so it's easy enough to parse the formatting. I have no clue how to go about splitting the text into paragraphs tho.

The Wolverine
Reply With Quote
Reply


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 03:21 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03890 seconds
  • Memory Usage 2,207KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete