Obsah fóra
PravidláRegistrovaťPrihlásenie




Odpovedať na tému [ Príspevok: 1 ] 
AutorSpráva
Offline

Prevádzkovateľ fóra
Prevádzkovateľ fóra
Frinendly date

Registrovaný: 01.05.05
Príspevky: 13348
Témy: 1496
Bydlisko: Bratislava
Príspevok NapísalOffline : 13.10.2006 9:09

Kód:
##############################################################
## MOD Title: frinendly date
## MOD Author: vegatron <webmaster@vega.4t.com>  - <www.jam3a.tk - www.alhandasa.net> (arabic sites)
## MOD Description:
##  This mod will replace the date with the word 'Today' or 'Yesterday' for the posts that are posted on today or yesterday,
##  which will make the date look more friendly.
##
## MOD Version: 1.0
##
## PHPBB Version: 2.0.0+
## Installation Level: easy
## Installation Time: ~ 1 Minutes
## Files To Edit:  1
##      includes/functions.php
##
## Included Files: N/A
##
##############################################################
## Author's Notes:
##
## The form of the displayed date is 'Today/yesterday - h:i a" ,so in case you wanted to change the date format
##  all you have to do is to edit the variable '$time_format'
##
## This MOD is released under the GPL License.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------
#
   return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));

#
#-----[ REPLACE WITH ]-----------------------------------
#

// friendly date mod\\*******************

   $thetime = ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
   
   $L_Today = 'Today';
   $L_Yesterday = 'Yesterday';
   $time_format = " - h:i a";// - hour:minute am/pm
   
   $date = getdate();
   $today = $date['mday'];
   $month = $date['mon'];
   $year = $date['year'];

   $forum_date_today = @gmdate ("d", $gmepoch);
   $forum_date_month = @gmdate ("m", $gmepoch);
   $forum_date_year = @gmdate ("Y", $gmepoch);
   
   if ($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year)
      $thetime = $L_Today . @gmdate ($time_format, $gmepoch);//today
   
   else
   if ($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year)
      $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
      
   else
   //if today is 1 and the month is not 1, then we have to check how many days in the previews month
   //and then set $yesterday to the last day in the previews month
   if ($today == 1 && $month != 1)
   {
   $yesterday = date ("t", mktime(0,0,0,($month-1),1,$year));//returns how many days in the previews month
   if ($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year)
      $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
   }
   else
   //if we are in the first day in the year
   if ($today == 1 && $month == 1)
   {
   $yesterday = date ("t", mktime(0,0,0,12,1,($year -1)));
   if ($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1))
      $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
   }

      return ($thetime);
//end friendly date \\*******************************

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM




Kód:
##############################################################
## MOD Title: frinendly date
## MOD Author: vegatron <webmaster@vega.4t.com>  - <www.jam3a.tk - www.alhandasa.net> (arabic sites)
## MOD Description:
##  This mod will replace the date with the word 'Today' or 'Yesterday' for the posts that are posted on today or yesterday,
##  which will make the date look more friendly.
##
## MOD Version: 1.0
##
## PHPBB Version: 2.0.0+
## Installation Level: easy
## Installation Time: ~ 1 Minutes
## Files To Edit:  1
##      includes/functions.php
##
## Included Files: N/A
##
##############################################################
## Author's Notes:
##
## The form of the displayed date is 'Today/yesterday - h:i a" ,so in case you wanted to change the date format
##  all you have to do is to edit the variable '$time_format'
##
## This MOD is released under the GPL License.
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------
#
   $thetime = ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));

#
#-----[ AFTER, ADD ]-----------------------------------
#
// friendly date mod\\*******************   
   $L_Today = 'Today';
   $L_Yesterday = 'Yesterday';
   $time_format = " - h:i a";// - hour:minute am/pm
   
   $date = getdate();
   $today = $date['mday'];
   $month = $date['mon'];
   $year = $date['year'];

   $forum_date_today = @gmdate ("d", $gmepoch);
   $forum_date_month = @gmdate ("m", $gmepoch);
   $forum_date_year = @gmdate ("Y", $gmepoch);
   
   if ($forum_date_today == $today && $forum_date_month == $month && $forum_date_year == $year)
      $thetime = $L_Today . @gmdate ($time_format, $gmepoch);//today
   
   else
   if ($today != 1 && $forum_date_today == ($today-1) && $forum_date_month == $month && $forum_date_year == $year)
      $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
      
   else
   //if today is 1 and the month is not 1, then we have to check how many days in the previews month
   //and then set $yesterday to the last day in the previews month
   if ($today == 1 && $month != 1)
   {
   $yesterday = date ("t", mktime(0,0,0,($month-1),1,$year));//returns how many days in the previews month
   if ($forum_date_today == $yesterday && $forum_date_month == ($month-1) && $forum_date_year == $year)
      $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
   }
   else
   //if we are in the first day in the year
   if ($today == 1 && $month == 1)
   {
   $yesterday = date ("t", mktime(0,0,0,12,1,($year -1)));
   if ($forum_date_today == $yesterday && $forum_date_month == 12 && $forum_date_year == ($year-1))
      $thetime = $L_Yesterday . @gmdate ($time_format, $gmepoch);//yesterday
   }

//end friendly date mod\\*******************************

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
# EoM







_________________
Streacom DA2 | SilverStone Titanium SX800-LTI 800W | ASRock X299E-ITX/ac | Intel Core i9-9980XE & be quiet! Dark Rock TF | Kingston HyperX Impact 64 GB DDR4 2666 MHz | NVIDIA Titan RTX 24 GB | Intel SSD Optane 905P 480 GB NVMe U.2 & Intel SSD 750 1,2 TB NVMe U.2 & Intel SSD 660p 2 TB NVMe M.2 & Seagate BackUp Plus Portable 56 TB USB | 55" 4K OLED Dell Alienware AW5520QF & 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech G603 | Logitech F710 | Harman Kardon Sabre SB 35 & Sennheiser RS 175 | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 | iPhone X 256 GB & Pitaka Aramid | SilverStone ML05B Milo | Corsair SF600 SFX 600W | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 & NOCTUA NH-L12S | Kingston HyperX Savage 32 GB DDR4 2400 MHz | NVIDIA GeForce GT 710 1 GB | Intel SSD Optane Memory 32 GB NVMe M.2 & Intel SSD 730 240 GB SATA | Ubuntu Server
Odpovedať na tému [ Príspevok: 1 ] 


Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy. date()

v PHP, ASP

4

348

30.10.2015 9:55

henrik35 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Funkcia date()

v PHP, ASP

1

442

26.06.2011 14:43

Ďuri Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. DATE + dni

v PHP, ASP

6

848

30.11.2009 20:41

jtomcik Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Meta name DATE ...

v HTML, XHTML, XML, CSS

1

501

08.05.2009 10:22

Ďuri Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. MySQL select date between

v Databázy

3

356

05.06.2013 20:48

stenley Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. php time() or date()

v PHP, ASP

0

599

12.07.2008 11:53

Proxy69 Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Kolko date za tuto zostavu??

v PC zostavy

12

716

06.04.2007 23:52

maugggly Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. PHP, DATE a TIME problem

v PHP, ASP

3

1219

09.05.2008 17:37

Andreyco Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. date mi infoo mojej maticnej ?

v Intel čipové sady

1

727

31.08.2007 13:04

Kamahl Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. čo znamena <Date ()-30 v acces

v Ostatné programy

0

594

12.02.2008 19:20

Svajny Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Up to date gaming PC do 1000€ (+/-50€)

v PC zostavy

14

617

24.06.2012 19:32

Daron Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Funkcia date('Y-m-d H:i:s'); nefunguje

v PHP, ASP

12

573

28.03.2017 17:36

JanoF Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. Virus? WARNING! Your Flash Player may be out of date

v Bezpečnosť a firewally

6

825

14.08.2014 14:46

Phanteom Zobrazenie posledných príspevkov

V tomto fóre nie sú ďalšie neprečítané témy. WARNING! Your Flash Player may be out of date NA MOBILE

v Antivíry a antispywary

0

485

01.03.2015 11:23

Melouch Zobrazenie posledných príspevkov


Nemôžete zakladať nové témy v tomto fóre
Nemôžete odpovedať na témy v tomto fóre
Nemôžete upravovať svoje príspevky v tomto fóre
Nemôžete mazať svoje príspevky v tomto fóre

Skočiť na:  

Powered by phpBB Jarvis © 2005 - 2024 PCforum, webhosting by WebSupport, secured by GeoTrust, edited by JanoF
Ako väčšina webových stránok aj my používame cookies. Zotrvaním na webovej stránke súhlasíte, že ich môžeme používať.
Všeobecné podmienky, spracovanie osobných údajov a pravidlá fóra