News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Poner las encuestas encima del Post

Started by pedroche, October 31, 2014, 02:05:28 PM

Previous topic - Next topic

pedroche

Hola!
Me gustaria saber como poner las encuestas justo encima de un Post, en lugar de mas arriva como salen por defecto.
Hay alguna forma?


Muchas gracias!
Saludos!

econsorte

Me sumo al pedido!

Gracias!
Versión del Foro: SMF 2.0.6

All Colours Sam

Este es el código que muestra las encuestas:


// Is this topic also a poll?
if ($context['is_poll'])
{
echo '
<div id="poll">
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" class="icon" /> ', $txt['poll'], '</span>
</h3>
</div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="content" id="poll_options">
<h4 id="pollquestion">
', $context['poll']['question'], '
</h4>';

// Are they not allowed to vote but allowed to view the options?
if ($context['poll']['show_results'] || !$context['allow_vote'])
{
echo '
<dl class="options">';

// Show each option with its corresponding percentage bar.
foreach ($context['poll']['options'] as $option)
{
echo '
<dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
<dd class="middletext statsbar', $option['voted_this'] ? ' voted' : '', '">';

if ($context['allow_poll_view'])
echo '
', $option['bar_ndt'], '
<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';

echo '
</dd>';
}

echo '
</dl>';

if ($context['allow_poll_view'])
echo '
<p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
}
// They are allowed to vote! Go to it!
else
{
echo '
<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';

// Show a warning if they are allowed more than one option.
if ($context['poll']['allowed_warning'])
echo '
<p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';

echo '
<ul class="reset options">';

// Show each option with its button - a radio likely.
foreach ($context['poll']['options'] as $option)
echo '
<li class="middletext">', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';

echo '
</ul>
<div class="submitbutton">
<input type="submit" value="', $txt['poll_vote'], '" class="button_submit" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</div>
</form>';
}

// Is the clock ticking?
if (!empty($context['poll']['expire_time']))
echo '
<p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>';

echo '
</div>
<span class="botslice"><span></span></span>
</div>
</div>
<div id="pollmoderation">';

// Build the poll moderation button array.
$poll_buttons = array(
'vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']),
'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'),
'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.gif', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']),
'lock' => array('test' => 'allow_lock_poll', 'text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']),
'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
);

template_button_strip($poll_buttons);

echo '
</div>';
}


Aquí es donde empieza el div que muestra los mensajes:

// Show the post itself, finally!
      echo '
                     <div class="post">';

SMF usa un bucle para mostrar los mensajes asi que si quieresn que solo aparezca en el primer mensaje, tendrán que poner un contador y agrear un condicionante tipo if ($counter == 1)

para que la encuesta solo se muestre en el primer mensaje, ovbiamente tienes que agregar su contador:

$counter = 0

while()
{
$counter++;


Despues de eso tendrán que adaptar el html de las encuestas para que se muestre bien dentor de un mensaje con un espacio reducido.


Como ven, son muchos los pasos que se tienen que hacer, francamente no recomiendo hacer este cambio.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

pedroche

#3
Gracias Suki!
Bufff pues si es complicado.

También podria ser justo debajo del titulo del tema, dentro de esa zona roja.
Esto mas que nada es para que las vean, por que tan arriba igual no las ven.

Por cierto, no has dicho en que archivo esta ese codigo?

Saludos!

All Colours Sam

Es exactamente lo mismo, sigue estando dentro de el bucle que usa SMf para mostrar los mensajes.

El archivo a editar es Display.template
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

econsorte

Muchas gracias Suki, ya pruebo el codigo! :)

pedroche

Quote from: econsorte on November 03, 2014, 02:52:33 PM
Muchas gracias Suki, ya pruebo el codigo! :)
Hola econsorte,
No dejes de decirnos que tal te ha ido. Yo no me atrevo a hacerlo
Saludos!

Advertisement: