← Desenvolvimento

PHP, duvidas e muito mais

Lida 3572 vezes

Offline

justangel 
Membro
Mensagens 924 Gostos 1
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

Estava a pensar em colocar no cinetuga, numa das colunas, um quadradinho com um apanhado dos 5 ultimos posts dos trailers. Como por exemplo existe em varios portais como este: www.foruns.org
é um mod certo? qual é o nome do mod e como o posso arranjar? é facil de instalar?
Offline

MiguelTavares 
Membro
Mensagens 3871 Gostos 0
Troféus totais: 33
Trófeus: (Ver todos)
Avatar Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4

No teu portal do CineTuga, aquilo é o eZportal? Diz-me o nome ... e eu arranjo-te isso! ;)
Offline

justangel 
Membro
Mensagens 924 Gostos 1
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

certo é o ezportal... tipo se fosse mambo o codigo seria outro?
Offline

kebrus 
Membro
Mensagens 459 Gostos 0
Troféus totais: 25
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 100 Posts

acho que não precisas de tanto, se o cinetuga utilizar mysql ou outra base de dados para guardar as informações é bastante facil, se não, utiliza-se consoante o metodo que tens de guardar informação, não há de ser muito dificil
Offline

MiguelTavares 
Membro
Mensagens 3871 Gostos 0
Troféus totais: 33
Trófeus: (Ver todos)
Avatar Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4

Aqui vai:

Código: [Seleccione]
#################################################################
## Title: Recent Topics Block for Smartor's ezPortal
## Author: Smartor <smartor_xp@hotmail.com> - http://smartor.is-root.com
## Description: This file explains you how to create Recent Topics block on ezPortal
##
## Files To Edit: 3
## portal.php
## templates/subSilver/portal_body.tpl
## language/lang_english/lang_main.php
##
## Included Files: N/A
##
#################################################################

#
#-----[ OPEN ]-------------------------------------------------------
#
portal.php

#
#-----[ FIND: in configuration section ]-------------------
#
// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
$CFG['poll_forum'] = '1';

#
#-----[ AFTER ADD ]---------------------------------------
# You could config it as well
#
// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '10';

// Exceptional Forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '';

#
#-----[ FIND ]---------------------------------------------
#
else
{
$l_total_user_s = $lang['Registered_users_total'];
}

#
#-----[ AFTER ADD ]---------------------------------------
#
//
// Recent Topics
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}

$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);

if( $CFG['exceptional_forums'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $CFG['exceptional_forums'];
}

for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
$recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
$template->assign_block_vars('recent_topic_row', array(
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
'L_TITLE' => $recent_topic_row[$i]['topic_title'],
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
'S_POSTER' => $recent_topic_row[$i]['username'],
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
)
);
}
//
// END - Recent Topics
//

#
#-----[ FIND ]---------------------------------------------
#
'L_VOTE_BUTTON' => $lang['Vote'],

#
#-----[ AFTER ADD ]----------------------------------------
#
// Recent Topics
'L_RECENT_TOPICS' => $lang['Recent_topics'],


#
#-----[ OPEN ]-------------------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]---------------------------------------------
#
$lang['No_poll'] = 'No poll at the moment';

#
#-----[ AFTER ADD ]----------------------------------------
#
$lang['Recent_topics'] = 'Recent topics'; // Recent Topics


#
#-----[ OPEN ]-------------------------------------------------------
#
templates/subSilver/portal_body.tpl

#
#-----[ FIND ]---------------------------------------------
#
 <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr>
<td class="catHead" height="25"><span class="genmed"><b>{L_STATISTICS}</b></span></td>
  </tr>
  <tr>
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS}<br />{NEWEST_USER}<br /><br/>{TOTAL_POSTS} {TOTAL_TOPICS}<br />&nbsp;</span></td>
  </tr>
 </table>
 
 <br />
#
# Scrolling Version
#-----[ AFTER ADD ]----------------------------------------
#
 <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr>
<td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td>
  </tr>
  <tr>
<td class="row1" align="left"><span class="gensmall">
<marquee id="recent_topics" behavior="scroll" direction="up" height="200" scrolldelay="100" scrollamount="2">
<!-- BEGIN recent_topic_row -->
&raquo; <a href="{recent_topic_row.U_TITLE}" onMouseOver="document.all.recent_topics.stop()" onMouseOut="document.all.recent_topics.start()">{recent_topic_row.L_TITLE}</a><br />
by <a href="{recent_topic_row.U_POSTER}" onMouseOver="document.all.recent_topics.stop()" onMouseOut="document.all.recent_topics.start()">{recent_topic_row.S_POSTER}</a> on {recent_topic_row.S_POSTTIME}<br /><br />
<!-- END recent_topic_row -->
</marquee>
</span></td>
  </tr>
 </table>
 
 <br />
#
# Classical Version
#-----[ OR ]------------------
#
 <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr>
<td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td>
  </tr>
  <tr>
<td class="row1" align="left"><span class="gensmall">
<!-- BEGIN recent_topic_row -->
&raquo; <a href="{recent_topic_row.U_TITLE}">{recent_topic_row.L_TITLE}</a><br />
by <a href="{recent_topic_row.U_POSTER}">{recent_topic_row.S_POSTER}</a> on {recent_topic_row.S_POSTTIME}<br /><br />
<!-- END recent_topic_row -->
</span></td>
  </tr>
 </table>
 
 <br />

#
#-----[ SAVE/UPLOAD ALL FILES ]------------------------------------------
#
# EoF



Funciona muito bem ;)
Offline

justangel 
Membro
Mensagens 924 Gostos 1
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

obrigado MeNz  :D