vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Display time only if date is today or yesterday (https://vborg.vbsupport.ru/showthread.php?t=75370)

coolegg 01-28-2005 10:00 PM

Display time only if date is today or yesterday
 
This is just the tiniest little mod, but some of you may find it useful.

I am big on keeping my sites as simple as possible for the surfer and not overloading them with useless information. So it has always bothered me to see the time displayed at various spots in my vB when it isn't important to do so. But the downside of disabling the time display site-wide is that it IS important sometimes.

So for example if a post was made today then I think the exact time it was made may be important to the surfers (was it 1 hour ago or 18 hours ago?). But if the post was made 4 months ago then who cares what the exact time was? - it's just brain clutter for the surfer.

So this little mini-mod will display the time in your template bits if the date is "Today" or "Yesterday", but disable the exact time for dates older than that.

It's VERY easy to do. The example below shows the mod for the forumhome_lastpostby template but it can also be done on the threadbit template and anywhere else where both the date and time are currently displayed by the template.

Template: forumhome_lastpostby
Find this:
Code:

$lastpostinfo[lastpostdate]
<if condition="!$show['detailedtime']">
<span class="time">$lastpostinfo[lastposttime]</span>
</if>

Change it to:
Code:

$lastpostinfo[lastpostdate]
<if condition="!$show['detailedtime']">
<if condition="(($lastpostinfo[lastpostdate]=='Today')||($lastpostinfo[lastpostdate]=='Yesterday'))">
<span class="time">$lastpostinfo[lastposttime]</span>
</if>
</if>

The attached image illustrates the effect of the change - time is only displayed if the date is Today or Yesterday.

Edit: This mod requires that you have the Yesterday/Today feature enabled under Date and Time Display Settings in Admin.

kamu 01-29-2005 05:49 PM

This belongs on any board, thanks.


All times are GMT. The time now is 10:06 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.00905 seconds
  • Memory Usage 1,710KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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