INICIO Category Blog Como saber tu edad en la wiki
Como saber tu edad en la wiki PDF Imprimir Correo electrónico
Escrito por Jesús Rivas   
16 de Diciembre de 2008

1º Debemos añadir la siguiente linea al archivo LocalSettings.php:

require_once( "{$IP}/extensions/YearsOld/YearsOld.php" );

2º Debemos añadir un archivo llamado YearsOld.php a la siguiente ruta "/extensions/YearsOld/"

3ºEn dicho documento debemos añadir lo siguiente:

<?php if (!defined('MEDIAWIKI')) die(); # Not a valid entry point, skip unless MEDIAWIKI is defined /**  * Returns Age from the day, month, year given.  * 2008-02-10 Bug: Using MKTIME just returns with valid unix timestamps, corrected  * 2008-02-10 Limit: Limit of 5'000'000 years for avoiding abuse  */   $wgExtensionCredits['parserhook'][] = array( 	'name' => 'YearsOld (1.1.82)', 	'author' => 'Hidalgo Rionda', 	'url' => 'http://www.mediawiki.org/wiki/Extension:YearsOld', 	'description' => 'Adds <yearsold d="DAY" m="MONTH" y="YEAR"></yearsold> and returns the Years passed since', );   $wgExtensionFunctions[] = 'efYearsOldSetup';   function efYearsOldSetup() {     global $wgParser;     $wgParser->setHook( 'yearsold', 'efYearsOldRender' ); }   function efYearsOldRender( $input, $args, $parser ) { 	global $wgYearsOldLimit; 	if (!$wgYearsOldLimit) { $wgYearsOldLimit = 5000000; } 	$anio = $args["y"]; 	if ($anio > ($wgYearsOldLimit - $wgYearsOldLimit - $wgYearsOldLimit) && $anio < $wgYearsOldLimit) { 		$multicin = 0; 		while ($anio < 1950) { 			$anio = $anio + 50; 			$multicin = $multicin + 1; 		} 		while ($anio > 2025) { 			$anio = $anio - 50; 			$multicin = $multicin - 1; 		} 		return htmlspecialchars( (intval(((time() - mktime(0, 0, 0, $args["m"], $args["d"], $anio)) / 60 / 60 / 24 / 365)) + ($multicin * 50)) ); 	} } 

4º Una vez hecho debemos coger una pagina que no este editada de la wiki y añadir la fecha de nacimiento como como el siguiente ejemplo:

5º Y al guardarlo sale la edad que tienes.

Ultima actualización ( 21 de Enero de 2009 )