Recordad que para pedir soporte alguno, debéis facilitar los datos de soporte oportunos por favor, mirad aquí y leer las Normas generales del foro, esto nos servirá de ayuda para dar el mejor soporte..

Gracias.

La Administración de phpBB España.

Hoy Y Ayer En Los Posts

Aquí­ podrás dejar tus dudas sobre MODs o MODificaciones de tu phpBB2
  Reglas del Foro
Antes de participar en los foros, leer esto por favor.
Normas generales de phpBB-Es y las de Soporte
Cerrado
Velas
Observador/a
Mensajes: 5
Registrado: 01 Feb 2006, 02:10

Hoy Y Ayer En Los Posts

#1

Mensaje por Velas »

Hola, me he bajado este mod de phpbbhacks, sirve para que te ponga Hoy y Ayer en los posts que son de hoy o de ayer:

[quote]
##############################################################
## MOD Title: frinendly date
## MOD Author: vegatron - (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 = 'Hoy';
$L_Yesterday = 'Ayer';
$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 [/quoteicy]

El caso es que si que funciona pero no bien, porque me pone como hoy los posts que son de ayer y como ayer los posts que son de antesdeayer. No se si me explico bien :oops: Como tendrí?­a que cambiarlo para que funcionara?

Gracias

Avatar de Usuario
ThE KuKa
Administrador
Mensajes: 10432
Registrado: 04 Ene 2004, 19:27
Género:
Edad: 50

Respuesta: Hoy Y Ayer En Los Posts

#2

Mensaje por ThE KuKa »

Ese no me suena, mirate este:
http://www.phpbb2.de/dload.php?action=file&file_id=317

S@lu2

📌 Raul [ThE KuKa] en phpBB 📌
✅ Jr. Extension Validator - Jr. Styles Validator - Style Customisations - Translator - International Support Team
✅

Si te gustan mis estilos, traducciones, etc. y quieres mostrar algo de aprecio, no dudes en hacer una donación Imagen
:flag_es: phpBB España - En línea desde 2003 :heart:



Nazcar
Ex Staff
Mensajes: 1728
Registrado: 14 Oct 2005, 20:39

Respuesta: Hoy Y Ayer En Los Posts

#3

Mensaje por Nazcar »

Código: Seleccionar todo

    
    $forum_da​te_today = @gmdate ("d", $gmepoch);​
    $forum_da​te_month = @gmdate ("m", $gmepoch);​
    $forum_da​te_year = @gmdate ("Y", $gmepoch);​ 
El mod coje la fecha del foro,mira que use la fecha correcta y que tu user tambien la coja correctamente

Velas
Observador/a
Mensajes: 5
Registrado: 01 Feb 2006, 02:10

Re: Respuesta: Hoy Y Ayer En Los Posts

#4

Mensaje por Velas »

Ese no me suena, mirate este:
http://www.phpbb2.de/dload.php?action=file&file_id=317

S@lu2 he instalado este y funciona perfectamente, muchas gracias a los 2 por ayudarme!

1 Saludo

Cerrado

Volver a “Soporte, preguntas sobre MODs de phpBB 2”