vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Separate post.postdate (https://vborg.vbsupport.ru/showthread.php?t=279191)

edyy 02-26-2012 07:38 PM

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!

Lynne 02-26-2012 09:34 PM

Use the function vbdate on the postdate timestamp. That function should be in /includes/functions.php

edyy 02-26-2012 10:14 PM

looks like this is over my head, maybe I am lucky and an addon will apear with something similar. Thanks for the help Lynne

kh99 02-26-2012 10:23 PM

Exactly where do you want it to be (which template)?

edyy 02-27-2012 03:55 PM

I want to use it in postbit_legacy

kh99 02-27-2012 04:34 PM

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

edyy 02-27-2012 05:51 PM

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.

kh99 02-27-2012 05:59 PM

Oops, 'postdate' should have been 'dateline' (in 3 places) - I fixed the code above.

Mark.B 02-27-2012 06:01 PM

1 Attachment(s)
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

edyy 02-27-2012 06:01 PM

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.


All times are GMT. The time now is 07:00 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.01105 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete