Calificación:
  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Fecha de Nacimiento desplegable estilo vBulletin en el Registro
#1
Bienvenidos a mi primer tutorial.

Procedemos entonces...

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

Código:
// If OpenID is enabled, give the user a choice between password and OpenID.

y antes de eso agregamos...

Código:
// 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 --//

Acá dejo un preview.

[Imagen: jbeyHsDYSpbDrP.png]


Posibles temas similares...
Tema Autor Respuestas Vistas Último mensaje
  Mod Notificaciones en el registro alexispro 0 348 10-05-2016, 01:09 PM
Último mensaje: alexispro
  lenguaje Registro 2016 jhoancito123 0 360 22-04-2016, 03:07 AM
Último mensaje: jhoancito123
  Mod para vídeos y registro de users anti spam bots (smf 2.0.1) Yakelin 1 347 01-12-2015, 07:51 PM
Último mensaje: Taquion
  Alguien tiene los temas de Vbulletin adaptado para smf Videomax 1 508 13-03-2015, 09:35 PM
Último mensaje: danieltumino
  Registro con Facebook cahcnehco29 3 703 01-11-2013, 04:39 AM
Último mensaje: Nomak
  [Mod] BBCode con estilo lukas 0 693 18-06-2013, 05:49 PM
Último mensaje: lukas
  Crear Foro Smf Video tutorial bien explicado ElCaBoMc 12 2,378 12-10-2012, 12:51 PM
Último mensaje: Vicen
  [TUTORIAL] Integrar Google Analytics en SMF Taquion 11 2,271 21-06-2012, 02:41 AM
Último mensaje: EnzoxD
  Pack de Temas VBulletin para SMF Network 33 8,646 14-06-2012, 12:35 PM
Último mensaje: Juliens



Usuarios navegando en este tema: 1 invitado(s)