1 sayfadan 1. sayfa

Yeni makaleler blogu ezPortal & IM Portal

İletiTarih: 31.03.2007, 23:32
butterflyT
Bu MOD ezPortal sayfaniza Yeni Makaleler blogu ekler.
Örnek için canver.net'in ana sayfasına bakabilirsiniz.

MOD SEO keyword URLs 2.3.1 ile uyumludur.

Eğer IM Portal kullanıyorsanız ekte verdiğim dosyayı indirin. Ancak bu standart bir MOD. SEO uyumu yok.

Kod: Tümünü seç
#################################################################
## Title: Recent Articles Block from KB MOD for Smartor's ezPortal
## Author: ButterflyT |~ http://www.canver.net
## Description: This file explains you how to create Recent Articles block on ezPortal
##
## Aciklama: Bu MOD ezPortal sayfaniza Yeni Makaleler blogu ekler.
##
## Requirement: KB (Knowledge Base) MOD
## Gerektirdikleri: KB (Knowledge Base) MOD
##
## Files To Edit: 4
##              includes/constants.php
##            portal.php
##              templates/subSilver/portal_body.tpl
##              language/lang_turkish/lang_main.php
##              language/lang_english/lang_main.php
##
## Included Files: N/A
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

#
#-----[ OPEN ]-------------------------------------------------------
#

includes/constants.php

#
#-----[ FIND ]-------------------
#

?>

#
#-----[ BEFORE ADD ]---------------------------------------
#

//
define('KB_ARTICLES_TABLE', $table_prefix.'kb_articles');
//

#
#-----[ 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
# If you have already $CFG['title_limit'], you can omit mine.
#
# Eger önceden $CFG['title_limit'] degiskenine sahipseniz benim
# yazdigimi iptal edebilirsiniz.
#

// Number of Recent Articles - Siralanacak makale sayisi
$CFG['number_recent_articles'] = '10';

// Limit for characters at title - Karakter limiti
$CFG['title_limit'] = '40';

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

#
# without SEO // SEO kullanmıyorsanız bunu ekleyiniz.
#
#-----[ AFTER ADD or]---------------------------------------
#

// Baslangic Son makaleler - Start Recent Articles
$sql = "SELECT *
FROM " . KB_ARTICLES_TABLE . "
WHERE approved = 1
ORDER BY article_id DESC LIMIT " . $CFG['number_recent_articles'];
            
if( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}
            
$number_recent_articles = $db->sql_numrows($result);
$recent_article_row = array();
while ($row = $db->sql_fetchrow($result))
{
   $recent_article_row[] = $row;
}

for ($i = 0; $i < $number_recent_articles; $i++)
{

// karakter limiti - limit for characters
   if (strlen($recent_article_row[$i]['article_title']) > $CFG['title_limit'])
      {
         $short_title = substr($recent_article_row[$i]['article_title'], 0, $CFG['title_limit'])."...";
      }
   else
      {
         $short_title = $recent_article_row[$i]['article_title'];
      }    
// karakter limiti - limit for characters
   
   $article_category_id = $recent_article_row[$i]['article_id'];
   $template->assign_block_vars('recent_articles_row', array(
      'U_TITLE' => append_sid($phpbb_root_path . "kb.$phpEx?mode=article&amp;k=$article_category_id"),
      'L_TITLE' => $recent_article_row[$i]['article_title'],
      'L_SHORT_TITLE' => $short_title,
      )
   );
}
            
// Bitis Son Makaleler - End Recent Articles

#
# with SEO // phpBB SEO keyword URLs 2.3.1 kullanıyorsunuz bunu kullanın.
# If you use phpBB SEO keyword URLs 2.3.1 you use this one
#
#-----[ AFTER ADD ]---------------------------------------
#

// Baslangic Son makaleler - Start Recent Articles (+) SEO
$sql = "SELECT *
FROM " . KB_ARTICLES_TABLE . "
WHERE approved = 1
ORDER BY article_id DESC LIMIT " . $CFG['number_recent_articles'];
            
if( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}
            
$number_recent_articles = $db->sql_numrows($result);
$recent_article_row = array();
while ($row = $db->sql_fetchrow($result))
{
   $recent_article_row[] = $row;
}

for ($i = 0; $i < $number_recent_articles; $i++)
{

// karakter limiti - limit for characters
   if (strlen($recent_article_row[$i]['article_title']) > $CFG['title_limit'])
      {
         $short_title = substr($recent_article_row[$i]['article_title'], 0, $CFG['title_limit'])."...";
      }
   else
      {
         $short_title = $recent_article_row[$i]['article_title'];
      }    
// karakter limiti - limit for characters

$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;

if(substr($server_url, -1, 1) != "/")
{
   $server_url .= "/";
}
    $article_category_id = $recent_article_row[$i]['article_id'];
   $viewarticle = $server_url . str_replace ('--', '-', make_url_friendly($recent_article_row[$i]['article_title']) . "-kba" . $article_category_id . ".html");
   $template->assign_block_vars('recent_articles_row', array(
      'U_TITLE' => $viewarticle,
      'L_TITLE' => $recent_article_row[$i]['article_title'],
      'L_SHORT_TITLE' => $short_title,
      )
   );
}
            
// Bitis Son Makaleler - End Recent Articles (+) SEO

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

#
#-----[ AFTER ADD ]----------------------------------------
#
   // Recent Articles
   'L_RECENT_ARTICLES' => $lang['Recent_articles'],

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

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

#
#-----[ AFTER ADD ]----------------------------------------
#
$lang['Recent_articles'] = 'Recent articles'; // Recent Articles

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

#
#-----[ FIND ]---------------------------------------------
#
$lang['No_poll'] =

#
#-----[ AFTER ADD ]----------------------------------------
#
$lang['Recent_articles'] = 'Son makaleler'; // Son Makaleler


#
#-----[ 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 />
#
#-----[ 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_ARTICLES}</b></span></td>
      </tr>
      <tr>
      <td class="row1" align="left"><span class="gensmall">
      <!-- BEGIN recent_articles_row -->
      &raquo; <a href="{recent_articles_row.U_TITLE}" title="{recent_articles_row.L_TITLE}">{recent_articles_row.L_SHORT_TITLE}</a>
      <br /><br />
      <!-- END recent_articles_row -->
      </span></td>
      </tr>
     </table>
    
     <br />

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

Cvp: Yeni makaleler blogu ezPortal & IM Portal

İletiTarih: 14.04.2007, 18:07
butterflyT
Yazdığım MOD'u kullanan varsa ufak bir değişiklik yaptığımı duyurmak istiyorum. Eskisi de çalışıyordu ancak güvenlik açısıdan aşağıdaki değişikliği yaptım.

Kod: Tümünü seç
#
#-----[ OPEN ]-------------------------------------------------------
#

includes/constants.php

#
#-----[ FIND ]-------------------
#

?>

#
#-----[ BEFORE ADD ]---------------------------------------
#

//
define('KB_ARTICLES_TABLE', $table_prefix.'kb_articles');
//

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

#
#-----[ FIND ]-------------------
#

FROM " . phpbb_kb_articles . "

#
#-----[ REPLACE WITH ]-------------------
#

FROM " . KB_ARTICLES_TABLE . "

Re: Yeni makaleler blogu ezPortal & IM Portal

İletiTarih: 19.04.2007, 00:41
CrazYAngeR
Ben bu makaleyi bir ara ne aradım anlatamam. Simuzerden istedim vermedi. Angelside verdi birtane ama istediğimi oda sağlayamadı. Şimdi sen verdin. Bende şimdi kullanmaya başlıcam saol butterfly. Klavyen yoldaşın olsun :D

Re: Yeni makaleler blogu ezPortal & IM Portal

İletiTarih: 19.04.2007, 01:43
Matmazella
smartor ve phpbb ye bile yazmıştım ben bunu.

Re: Yeni makaleler blogu ezPortal & IM Portal

İletiTarih: 19.04.2007, 22:14
CrazYAngeR
Niye vermedin o zaman. Yönetim bölümünde o kadar yalvardım biriniz bile vermediniz. Bi sen verdin o da farklı çıktı :?