¿Por qué recibo el error de sintaxis 'endwhile' inesperado (T_ENDWHILE) en esta plantilla?
2 abr 2014, 18:08:08
Vistas: 17.3K
Votos: 2
Estoy intentando mostrar un formulario cuando el usuario está conectado, pero obtengo este error en el navegador al subir el código:
syntax error, unexpected 'endwhile' (T_ENDWHILE) in
Mi código:
<?php
/*
Plantilla: Clientes
*/
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php if (is_user_logged_in()):
echo '<form type="post" action="" id="newCustomerForm"> ';
echo '<label for="name">Nombre:</label>';
echo'<input name="name" type="text" />';
echo'<label for="email">Correo electrónico:</label>';
echo'<input name="email" type="text" />';
echo'<label for="phone">Teléfono:</label>';
echo'<input name="phone" type="text" />';
echo'<label for="address">Dirección:</label>';
echo'<input name="address" type="text" />';
echo'<input type="hidden" name="action" value="addCustomer"/>';
echo'<input type="submit">';
echo'</form>';
echo'<br/><br/>';
echo'<div id="feedback"></div>';
echo '<br/><br/>';
else:
echo 'Lo sentimos, solo usuarios registrados pueden ver esta información';
?>
<?php endwhile; // fin del bucle. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

User
100
Todas las respuestas a la pregunta
2
0
Olvidaste cerrar la sentencia if
. Esto debería funcionar:
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php if (is_user_logged_in()):
echo '<form type="post" action="" id="newCustomerForm"> ';
echo '<label for="name">Nombre:</label>';
echo'<input name="name" type="text" />';
echo'<label for="email">Correo electrónico:</label>';
echo'<input name="email" type="text" />';
echo'<label for="phone">Teléfono:</label>';
echo'<input name="phone" type="text" />';
echo'<label for="address">Dirección:</label>';
echo'<input name="address" type="text" />';
echo'<input type="hidden" name="action" value="addCustomer"/>';
echo'<input type="submit">';
echo'</form>';
echo'<br/><br/>';
echo'<div id="feedback"></div>';
echo '<br/><br/>';
else:
echo 'Lo sentimos, solo usuarios registrados pueden ver esta información';
?>
<?php endif;?>
<?php endwhile; // fin del loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

user48752
46
2 abr 2014 18:25:58
Preguntas relacionadas
1
respuestas