Simple Machines Community Forum

SMF Support => Español (Spanish) => Language Specific Support => Tutoriales => Topic started by: daviloco on February 07, 2012, 12:30:44 AM

Title: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: daviloco on February 07, 2012, 12:30:44 AM
Bueno antes que nada esto  lo logro hacer nodensdorian (http://www.simplemachines.org/community/index.php?action=profile;u=295401), de el parse de Intuitive Age (http://custom.simplemachines.org/mods/index.php?mod=3118)

Procedemos entonces...

Nos vamos a nuestro ./Themes/default/Register.template.php
y buscamos esto...

// If OpenID is enabled, give the user a choice between password and OpenID.

y antes de eso agregamos...


   // Born on Register By daviloco www.midescargawarez.com
   //-- Labradoodle-360; Intuitive Age
   global $context, $txt, $modSettings;
   if (cache_get_data('intuitive_age', 120) != null)
   {
      $years = cache_get_data('intuitive_age', 120);
   }
   else
   {
      $years = array();
      $base_year = 1904;
      $current_year = date('Y');
      $count = $base_year;
      $age = 0;
      $ages = array();
      while ($count < $current_year)
      {
         ++$count;
         $years[] = $count;
      }
      $years = array_reverse($years);
      foreach ($years as $year)
      {
         $ages[$year] = ++$age;
         $year = array();
         $year[$age] = $year;
      }
      cache_put_data('intuitive_age', $years, 120);
   }
   $days = array(
      1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
      11, 12, 13, 14, 15, 16, 17, 18,
      19, 20, 21, 22, 23, 24, 25, 26,
      27, 28, 29, 30, 31,
   );

   // "Pretty box", huh? Now it's pretty
   echo '<dl class="register_form" id="birthday"><dt>
         <strong>', $txt['dob'], ':</strong>
      </dt>
      <dd>
         <select name="bday1" id="bday1" style="padding: 4px;">
            <option value="00"', isset($context['member']['birth_date']['month']) && ($context['member']['birth_date']['month'] == '' || $context['member']['birth_date']['month'] == '00') ? ' selected="selected"' : '', '>', $txt['calendar_month'], '&nbsp;</option>';
               foreach ($txt['months_short'] as $key => $month)
               {
                  echo '<option value="', $key, '"', !empty($context['member']['birth_date']['month']) && $context['member']['birth_date']['month'] == $key ? ' selected="selected"' : '', '>', $month, '&nbsp;</option>';
               }
         echo '</select>
         <select name="bday2" id="bday2" style="padding: 4px;">
            <option value="00"', isset($context['member']['birth_date']['day']) && ($context['member']['birth_date']['day'] == '' || $context['member']['birth_date']['day'] == '00') ? ' selected="selected"' : '', '>', $txt['calendar_day'], '&nbsp;</option>';
               foreach ($days as $day)
               {
                  echo '<option value="', $day, '"', !empty($context['member']['birth_date']['day']) && $context['member']['birth_date']['day'] == $day ? ' selected="selected"' : '', '>', $day, '&nbsp;</option>';
               }
         echo '</select>';
         if (!empty($years))
         {
            echo '<select name="bday3" id="bday2" style="padding: 4px;">
                  <option value="0000"', isset($context['member']['birth_date']['year']) && ($context['member']['birth_date']['year'] == '' || $context['member']['birth_date']['year'] == '0000') ? ' selected="selected"' : '', '>', $txt['calendar_year'], '&nbsp;</option>';
                     foreach ($years as $key => $year)
                     {
                        echo '<option value="', $year, '"', !empty($context['member']['birth_date']['year']) && $context['member']['birth_date']['year'] == $year ? ' selected="selected"' : '', '', !empty($modSettings['coppaAge']) && $modSettings['coppaAge'] >= $year && $modSettings['coppaType'] == 0 ? ' disabled="disabled"' : '', '>', $year, '&nbsp;</option>';
                     }
            echo '</select>';
         }
         else
         {
            echo '<input type="text" name="bday3" size="4" maxlength="4" value"', $context['member']['birth_date']['year'], '" class="input_text" />';
         }
   echo '</dd></dl>';
   // End Labradoodle-360; Intuitive Age --//


Aca dejo y adjunto la captura...

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.minus.com%2FjbeyHsDYSpbDrP.png&hash=5d5cae5c3b8ccc791fb0d9719ec4b737a202c991)
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: distante on February 07, 2012, 12:42:11 AM
Deberías poner una captura ;)

saludos!
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: daviloco on February 07, 2012, 12:49:35 AM
Quote from: distante on February 07, 2012, 12:42:11 AM
Deberías poner una captura ;)

saludos!

Alli esta!...
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: distante on February 07, 2012, 12:53:55 AM
Cool ;)

Seguro mañana lo mueven a tutoriales!
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: daviloco on February 07, 2012, 12:59:49 AM
De nada!
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: 4Kstore on February 07, 2012, 03:41:30 AM
Quote from: daviloco on February 07, 2012, 12:30:44 AM
PD: No puedo postear en Tutoriales :(

Movido, gracias por compartir.
Saludos
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: Muniecoo on February 07, 2012, 01:58:53 PM
uhh buenisimo! despues lo implemento en mi foro :D
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: ___Matu___ on February 11, 2012, 05:54:07 PM
hola esto se puede hacer que sea obligatorio en la parte de los registros ??
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: daviloco on February 12, 2012, 02:25:52 PM
Quote from: ___ZEUS___ on February 11, 2012, 05:54:07 PM
hola esto se puede hacer que sea obligatorio en la parte de los registros ??

No, este tuto es para que se muestre y sea opcional. Si gustan poner su fecha de registro y sino normal igual graba null o con datos...seria bueno que alguien nos de la mano para ese proposito...
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: luismontiel on September 27, 2015, 04:22:20 AM
no me salio la palabra fecha de nacimiento..      solo los dos puntos
Title: Re: [Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
Post by: -Rock Lee- on September 27, 2015, 09:17:18 AM
Quote from: luismontiel on September 27, 2015, 04:22:20 AM
no me salio la palabra fecha de nacimiento..      solo los dos puntos

El problema esta que no puso la frase que debe aparecer en:

<strong>', $txt['dob'], ':</strong>

debe ir:

<strong>', $txt['dob'], 'Fecha de nacimiento:</strong>

con eso debería funcionar :)!


Saludos!