Re: User Blog Mod Block
Posted: 23. April 2009 20:49
thanks, it is working 

Kevin wrote:To use the advantages of new features for additional blocks (easier updating portals with additional blocks) and the template variables, i would suggest to build the code of Dan up like this:
- open root/portal/block/additional_blocks.php
find:add after:Code: Select all
if (!defined('IN_PORTAL')) { exit; }
Code: Select all
include($phpbb_root_path . 'portal/block/blog_block.'.$phpEx);
- Create a new File, called blog_block.php, contend:
upload this file to root/portal/block/Code: Select all
<?php if (!defined('IN_PHPBB')) { exit; } if (!defined('IN_PORTAL')) { exit; } // Output Blog Entries $blog_limit = 5; $user->add_lang(array('mods/blog/common', 'mods/blog/view')); include($phpbb_root_path . 'blog/functions.' . $phpEx); $blog_data = new blog_data(); $recent_blog_ids = $blog_data->get_blog_data('recent', 0, array('limit' => $blog_limit)); $blog_data->get_user_data(false, true); update_edit_delete(); if ($recent_blog_ids !== false) { foreach ($recent_blog_ids as $id) { $template->assign_block_vars('recent_blogs', array_merge($blog_data->handle_user_data(blog_data::$blog[$id]['user_id']), $blog_data->handle_blog_data($id, $config['user_blog_text_limit']))); } } ?>
- Create a new File, called blog_block.html, contend:
upload this file to root/styles/prosilver/portal/block/Code: Select all
{$C_BLOCK_H_L}<dl><dt>{L_RECENT_BLOGS}</dt></dl>{$C_BLOCK_H_R} <div class="panel" style="margin-bottom: 0px"> <div class="inner"><span class="portal-corners-top-inner"></span> <!-- BEGIN recent_blogs --> <div class="post bg1<!-- IF recent_blogs.S_REPORTED or recent_blogs.S_UNAPPROVED --> reported<!-- ENDIF --><!-- IF recent_blogs.S_DELETED --> deleted<!-- ENDIF -->" <!-- IF recent_blogs.POST_COLOR and not recent_blogs.S_REPORTED and not recent_blogs.S_UNAPPROVED and not recent_blogs.S_DELETED -->style="background-color: {recent_blogs.POST_COLOR}"<!-- ENDIF -->> <div class="inner"><span class="corners-top"><span></span></span> <div class="postbody" style="width: 100%;"> <!-- IF recent_blogs.S_UNAPPROVED or recent_blogs.S_REPORTED --> <p class="rules"> <!-- IF recent_blogs.S_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{recent_blogs.U_APPROVE}"><strong>{L_UNAPPROVED}</strong></a><!-- ENDIF --> <!-- IF recent_blogs.S_REPORTED -->{REPORTED_IMG} <a href="{recent_blogs.U_REPORT}"><strong>{L_REPORTED_SHORT}</strong></a><!-- ENDIF --> </p> <!-- ENDIF --> <dl> <dt> <strong><!-- IF recent_blogs.S_HAS_POLL --><img src="{T_THEME_PATH}/images/blog/icon_poll.gif" style="float: right;" alt="" /> <!-- ENDIF --><a href="{recent_blogs.U_VIEW}">{recent_blogs.TITLE}</a></strong> {L_POST_BY_AUTHOR} <strong>{recent_blogs.USER_FULL}</strong> {L_POSTED_ON_DATE} {recent_blogs.DATE} <br /> <div class="content" style="width: 95%; padding: 4px;">{recent_blogs.MESSAGE}</div> <!-- IF recent_blogs.S_HAS_ATTACHMENTS --> <dl class="attachbox"> <dt>{L_ATTACHMENTS}</dt> </dl> <!-- ENDIF --> <br clear="all" /> <div> <span class="num_replies">{recent_blogs.REPLIES}</span> {recent_blogs.VIEWS} </div> </dt> </dl> </div><span class="corners-bottom"><span></span></span> </div> </div> <!-- END recent_blogs --> <span class="portal-corners-bottom-inner"></span></div> </div> {$C_BLOCK_F_L}{$C_BLOCK_F_R}
- open /styles/prosilver/template/portal/block/additional_blocks_center.html
find:add after:Code: Select all
<!-- additional_blocks //-->
Code: Select all
<!-- INCLUDE portal/block/blog_block.html -->
Not tested, but that should be it. Dont forget to purge the cache afterwards.
Code: Select all
[phpBB Debug] PHP Notice: in file /blog/includes/blog_data.php on line 440: Undefined index: MAX_OPTION_SELECT
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4247: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3503)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4249: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3503)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4250: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3503)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4251: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3503)