TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 02, 2024, 04:35:40 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,176
  • Total Topics: 21,220
  • Online today: 127
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 96
  • Total: 96

Blok yazılımcıkları (Block Snippets)

Started by sarba126, March 29, 2006, 07:59:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bbTURK

hangi sürümü kullanıyorsun?
0.9.8 için
eğer ön blokları önce gösteri seçtiysen, orta blok olarak ekle ve sıra olarak en alta al.
eğer ön blokları sonra gösteri seçitysen, önblok olarak ekle ve sırasını en alta al.

alqo

0.9.8 kullanıyorum yalnız  tamam bende onu yapa  biliyorum ama  sorunum ÅŸu (forum mesajları var orta blokta  yani seçtiÄŸim katagorilerden mesaj ekleniyor  onların altına almak istiyorum son konuları..)

forum mesajlarını şöyle ekledim ayarlar  önsayfa forum mesajları ordan 4 seçenek var ordan seçtim orta  bloklarda  gösteriyor

umarım anlata bilmiÅŸimdir yardımların için saÄŸoL  tek başına  bu çaba süper.. (Yola devam) :)

bbTURK

teşekkürler.
ÅŸimdi ÅŸunu bir dener misin
önsayfa ayarlarından önblokları sonra ekleyi seç.
daha sonra ön blok oluştur ve eklemek istediğin yazılımcığı o bloğa ekle.

böyle yapıtında sırasıyla

orta bloklar

forum mesajları

önbloklar gözükür


erdem30

Quote from: alp on November 23, 2007, 01:15:33 PM
Anket anasayfada gösterimi

php box da yapılacak.
// display most recent poll from board number 1
tp_showPoll(13663.0);   (en altta)

13663.0 buraya sizin adres çubuğundaki numarayı yazacaksınız

//Enhanced showPoll block
// Shows poll in block from specified topic,
// or the most recent from specified board
//
// Author: Greybrow
// Version: 2007-04-24 22:00
// Features:
// shows poll (or polls) that fits in a block
//         voting or scores (when voted or can't vote)
// shows question as a topic link
// shows poll from specified topic
// shows most recent poll from specified board
//
// based on ssi_showPoll();
// added block hacks by Raysr and Thurnok from:
//    http://tpblocks.ccs-net.com/index.php?topic=25
//    http://tpblocks.ccs-net.com/index.php?topic=40
//
// usage:
// - copy whole code to phpblock.
// - at the end of the code use function
// tp_showPoll(topic number or null, 'echo' or null, board number or null)
// or
// copy the function to SSI.php
// put only the function call in phpblock
//
// examples:
// show the poll from topic 34
// tp_showPoll(34);                     
//
// show the most recent poll from the board number 5
// tp_showPoll(null,'echo',5);           
//
// keep in mind, that if board is specified, topic is ignored
// so it will display the same as above
// tp_showPoll(34,'echo',5)             
//
// put the array with poll from board 5 into $thepoll variable
// $thepoll = tp_showPoll(null,null,5); 
//
// if you call the function more than once,
// with different options, block will show more polls
// but I'm not sure if voting would work correctly :(
///////////////////////////////////////////////////////

function tp_showPoll($topic = null, $output_method = 'echo', $board = null)
{
global $db_prefix, $txt, $ID_MEMBER, $settings, $boardurl, $sc, $user_info;
global $context;

$boardsAllowed = boardsAllowedTo('poll_view');

if (empty($boardsAllowed))
return array();

if ($topic === null && isset($_REQUEST['ssi_topic']))
$topic = (int) $_REQUEST['ssi_topic'];
else
$topic = (int) $topic;

if ($board === null)
{
// board not chosen, so get the one from specified topic
$request = db_query("
SELECT
p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes, b.ID_BOARD
FROM ({$db_prefix}topics AS t, {$db_prefix}polls AS p, {$db_prefix}boards AS b)
WHERE p.ID_POLL = t.ID_POLL
AND t.ID_TOPIC = $topic
AND b.ID_BOARD = t.ID_BOARD
AND $user_info[query_see_board]" . (!in_array(0, $boardsAllowed) ? "
AND b.ID_BOARD IN (" . implode(', ', $boardsAllowed) . ")" : '') . "
LIMIT 1", __FILE__, __LINE__);
}
else
{
// board chosen, so lets try to get the most recent poll from it
$board = (int) $board;
$request = db_query("
SELECT
p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes, b.ID_BOARD, t.ID_TOPIC
FROM ({$db_prefix}topics AS t, {$db_prefix}polls AS p, {$db_prefix}boards AS b)
WHERE p.ID_POLL = t.ID_POLL
AND b.ID_BOARD = t.ID_BOARD
AND b.ID_BOARD = $board
AND $user_info[query_see_board]" . (!in_array(0, $boardsAllowed) ? "
AND $board IN (" . implode(', ', $boardsAllowed) . ")" : '') . "
ORDER BY p.ID_POLL DESC
LIMIT 1", __FILE__, __LINE__);
}

// Either this topic has no poll, or the user cannot view it.
if (mysql_num_rows($request) == 0)
return array();

$row = mysql_fetch_assoc($request);
mysql_free_result($request);

if($topic == 0)
$topic = (int)$row['ID_TOPIC'];

// Check if they can vote.
if ((!empty($row['expireTime']) && $row['expireTime'] < time()) || $user_info['is_guest'] || !empty($row['votingLocked']) || !allowedTo('poll_vote', $row['ID_BOARD']))
$allow_vote = false;
else
{
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}log_polls
WHERE ID_POLL = $row[ID_POLL]
AND ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
$allow_vote = mysql_num_rows($request) == 0;
mysql_free_result($request);
}
$request = db_query("
SELECT COUNT(DISTINCT ID_MEMBER)
FROM {$db_prefix}log_polls
WHERE ID_POLL = $row[ID_POLL]", __FILE__, __LINE__);
list ($total) = mysql_fetch_row($request);
mysql_free_result($request);

$request = db_query("
SELECT ID_CHOICE, label, votes
FROM {$db_prefix}poll_choices
WHERE ID_POLL = $row[ID_POLL]", __FILE__, __LINE__);
$options = array();
$total_votes = 0;
while ($rowChoice = mysql_fetch_assoc($request))
{
censorText($rowChoice['label']);

$options[$rowChoice['ID_CHOICE']] = array($rowChoice['label'], $rowChoice['votes']);
$total_votes += $rowChoice['votes'];
}
mysql_free_result($request);

$return = array(
'id' => $row['ID_POLL'],
'image' => empty($pollinfo['votingLocked']) ? 'poll' : 'locked_poll',
'question' => $row['question'],
'total_votes' => $total,
'is_locked' => !empty($pollinfo['votingLocked']),
'allow_vote' => $allow_vote,
'topic' => $topic
);

// Calculate the percentages and bar lengths...
$divisor = $total_votes == 0 ? 1 : $total_votes;
foreach ($options as $i => $option)
{
$bar = floor(($option[1] * 100) / $divisor);
$barWide = $bar == 0 ? 1 : floor(($bar * 5) / 6);
$return['options'][$i] = array(
'id' => 'options-' . $i,
'percent' => $bar,
'votes' => $option[1],
'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll_left.gif" alt="" /><img src="' . $settings['images_url'] . '/poll_middle.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll_right.gif" alt="" /></span>',
'option' => parse_bbc($option[0]),
'vote_button' => '<input type="' . ($row['maxVotes'] > 1 ? 'checkbox' : 'radio') . '" name="options[]" id="options-' . $i . '" value="' . $i . '" class="check" />'
);
}

$return['allowed_warning'] = $row['maxVotes'] > 1 ? sprintf($txt['poll_options6'], $row['maxVotes']) : '';

if ($output_method != 'echo')
return $return;

if ($return['allow_vote'])
{
echo '
<form action="', $boardurl, '/SSI.php?ssi_function=pollVote" method="post" accept-charset="', $context['character_set'], '">
<input type="hidden" name="poll" value="', $return['id'], '" />
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td colspan="2" class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>
<tr>
<td class="smalltext">', $return['allowed_warning'], '</td>
</tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td class="smalltext"><label for="', $option['id'], '">', $option['vote_button'], '</td><td class="smalltext">', $option['option'], '</label></td>
</tr>';
echo '
<tr>
<td colspan="2" class="smalltext"><input type="submit" value="', $txt['smf23'], '" /></td>
</tr>
</table>
<input type="hidden" name="sc" value="', $sc, '" />
</form>';
}
else
{
echo '
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td colspan="2" class="smalltext"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><b>', $return['question'], '</b></a></td>
</tr>';
foreach ($return['options'] as $option)
echo '
<tr>
<td colspan="2" align="left" valign="top" style="font-style: italic" class="smalltext">', $option['option'], '</td>
</tr>
<tr>
<td align="left" class="smalltext">', $option['bar'], '</td>
<td align="left" class="smalltext">', $option['votes'], ' (', $option['percent'], '%)</td>
</tr>';
echo '
<tr>
<td colspan="2" class="smalltext"><b>', $txt['smf24'], ': ', $return['total_votes'], '</b></td>
</tr>
</table>';
}
}

///////////////////////////////////////
// display most recent poll from board number 1
tp_showPoll(13663.0);   


Bu anketi koydum.Ancak sadece üyelere görünüyor.Ziyaretçilere başlık görünüyor o kadar.Forum içeriği ziyeretçilere kapalı onunla alakalı olabilirmi.

bbTURK

kodu denemdiğim için kesin konuşmuyorum ama büyük olasılıkla onunla alakalı

erdem30

Quote from: bbTURK on September 18, 2008, 08:57:29 PM
kodu denemdiğim için kesin konuşmuyorum ama büyük olasılıkla onunla alakalı
Yok hocam içeriği açtım anket hala ziyaretçilere kapalı.

alqo

Quote from: erdem30 on September 19, 2008, 07:13:49 PM
Quote from: bbTURK on September 18, 2008, 08:57:29 PM
kodu denemdiğim için kesin konuşmuyorum ama büyük olasılıkla onunla alakalı
Yok hocam içeriği açtım anket hala ziyaretçilere kapalı.

admin panelinde üye izinlerine gir ziyaretciler Düzenle tıkla sonra  Anketleri görebilir

Bu işini görür arkadaşım

Muxa

Arkdaşlar shoutbox nasıl yapılıyor tpde?

versiyorn 0.9.8

bbTURK

bloklardan yeni blok oluştur. türünü shoutbox seç.