Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 02-26-2012, 07:38 PM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Separate post.postdate

Hy ,
I have a little probleme, I want to put the date of a post on the left of the thread title and I wnat that on 3 lines. the first line to be the day , the second to be the month and the third to be the year. the problem is I dont' know how to separete the post.postdate variable in three parts day , month, year. Or if somoane can give me another ideea how to put the date in three separate lines without puting each part in his own div, table , etc

Thanks!
Reply With Quote
  #2  
Old 02-26-2012, 09:34 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use the function vbdate on the postdate timestamp. That function should be in /includes/functions.php
Reply With Quote
  #3  
Old 02-26-2012, 10:14 PM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

looks like this is over my head, maybe I am lucky and an addon will apear with something similar. Thanks for the help Lynne
Reply With Quote
  #4  
Old 02-26-2012, 10:23 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Exactly where do you want it to be (which template)?
Reply With Quote
  #5  
Old 02-27-2012, 03:55 PM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I want to use it in postbit_legacy
Reply With Quote
  #6  
Old 02-27-2012, 04:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, you could create a plugin using hook location postbit_display_complete and code like this:

PHP Code:
$post['day'] = vbdate('l'$post['dateline']);
$post['month'] = vbdate('F'$post['dateline']);
$post['year'] = vbdate('Y'$post['dateline']); 
and then in the template use {vb:raw post.day}, {vb:raw post.month}, and {vb:raw post.year}.

To see what the 'l', 'F', and 'Y' mean and what other things you could put there, see this page in the php manual: http://us2.php.net/manual/en/function.date.php

If you haven't created a plugin before, see the vb manual here: https://www.vbulletin.com/docs/html/main/add_plugin
Reply With Quote
Благодарность от:
edyy
  #7  
Old 02-27-2012, 05:51 PM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've created the plugin and it works but it displays the date january 1970, how I make it to show the date of the post.
Reply With Quote
  #8  
Old 02-27-2012, 05:59 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oops, 'postdate' should have been 'dateline' (in 3 places) - I fixed the code above.
Reply With Quote
  #9  
Old 02-27-2012, 06:01 PM
edyy edyy is offline
 
Join Date: Jul 2010
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works perfect. Thank you for your help.

--------------- Added [DATE]1330369427[/DATE] at [TIME]1330369427[/TIME] ---------------

Yes I try to recreate your calendar, I hope you don't mind. The plugin kh99 made works perfect.
Reply With Quote
  #10  
Old 02-27-2012, 06:01 PM
Mark.B Mark.B is offline
Senior Member
 
Join Date: Feb 2004
Posts: 1,354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

edyy is hoping to recreate the "Calendar" style date boxes I use on my forum.

Here is exactly what I have at the same hook location:

Code:
$post['month'] = date('M', $post['dateline']);
$post['month'] = strtoupper($post['month']);
$post['day'] = date('d', $post['dateline']);
$post['year'] = date('Y', $post['dateline']);
The only real difference in mine is the addition of a line of code to convert the month to upper case.

Make sure the plugin is at the correct location AND you have it set to "Active".

I use it to create the below:

Attachment 136723
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 10:48 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
  • Page Generation 0.06424 seconds
  • Memory Usage 2,261KB
  • Queries Executed 12 (?)
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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete