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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2006, 05:07 AM
roosevelt roosevelt is offline
 
Join Date: Aug 2004
Location: MD, USA
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default converting dateline and parsing bbcode

Hi everyone.
Those of you know about my vrssi project then you surely know why I need to know this. Anyways those who don't I am trying to display thread contents and display them as news in a static/dynamic webpage. Now it works just fine, but I have two little problems. One is the codes stored in the database are bb code not html so when it displays in webpage its like
PHP Code:
[URL]www.vbulletin.org[/url
and second I don't really know how to convert the dateline format into somthing more human readable like December 25, 1989. Which function in vbulletin basically does those job? First converts the bb code to HTML and decrypts the dateline integers? .

Thanks in advance!!
Reply With Quote
  #2  
Old 06-17-2006, 07:02 AM
Alan @ CIT Alan @ CIT is offline
 
Join Date: Nov 2004
Location: South UK
Posts: 625
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

For the BBCode, there is a bbcode parser class that will convert it for you. Take a look at includes/class_bbcode.php.

For the dateline, use vbdate(). Eg:

PHP Code:
// For dates
echo vbdate($vbulletin->options['dateformat'], $myDateline);

// For times
echo vbdate($vbulletin->options['timeformat'], $myDateline); 
Thanks,
Alan.
Reply With Quote
  #3  
Old 06-17-2006, 03:14 PM
roosevelt roosevelt is offline
 
Join Date: Aug 2004
Location: MD, USA
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks m8 I got the dateline working just fine. However having some trouble with bbcode parsing. I have the news file in the forum directory so I just included the same files index.php has . However when I initialize the bbcode parser it gives me this error:
Code:
 	
Fatal error: Cannot instantiate non-existent class: vb_bbcodeparser in /path/to/forum/directory/news.php on line 10
.

This is what I have in 10,

$rbbcode = & new vB_BbCodeParser($vbulletin, fetch_tag_list());

and later in the code I am trying to parse the data like this: $news = $rbbcode->parse($data['pagetext'], $forumid);

The vB_BbCodeParser requires the following parameters,
vB_Registry Reference to registry object
array List of tags to parse

Any ideas?
Reply With Quote
  #4  
Old 06-17-2006, 03:48 PM
Alan @ CIT Alan @ CIT is offline
 
Join Date: Nov 2004
Location: South UK
Posts: 625
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try adding

PHP Code:
require_once(DIR '/includes/class_bbcode_parser.php'); 
At the top of the file

Thanks,
Alan.
Reply With Quote
  #5  
Old 06-17-2006, 04:11 PM
roosevelt roosevelt is offline
 
Join Date: Aug 2004
Location: MD, USA
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks alan, I was reviewing the showthread.php file and saw that it does include the class_bbcode.php file seperately where I thought it is included within global.php. Thanks for your support .
Reply With Quote
  #6  
Old 07-07-2006, 05:58 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vbdate() is my friend! I had been using my own function to display the date peoperly up till now, lol. Thanks!
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 09:38 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.03841 seconds
  • Memory Usage 2,212KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_postinfo_query
  • fetch_postinfo
  • 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