Customization Of Forum_attach_block.tpl


Subject: Customization Of Forum_attach_block.tpl
Hi everybody!

I'd like to customize forum_attach_block.tpl in order to visualize in the bottom of forum_attach windows: "this news item has X Views and X comments" like in news_block.tpl.

forum_attach_1

I know that the necessary code for the template is:

Code: [Download] [Hide] [Select]
{L_NEWS_SUMMARY}&nbsp;<a href="{articles.U_VIEWS}"><b>{articles.COUNT_VIEWS}</b>&nbsp;{L_NEWS_VIEWS}</a>&nbsp;{L_NEWS_AND}&nbsp;<a href="{articles.U_COMMENT}"><b>{articles.COUNT_COMMENTS}</b>&nbsp;{L_NEWS_COMMENTS}</a>


The problem for me is: how to modify php files in order to utilize that code?

For the moment I have done this modification:

OPEN

templates/(your_template)/blocks/forum_attach_block.tpl


FIND
Code: [Download] [Hide] [Select]
<td align="left"><span class="gensmall">{articles_fp.POSTER_CG}&nbsp;[ {articles_fp.TIME} ]

REPLACE WITH

Code: [Download] [Hide] [Select]
<td align="left"><span class="gensmall">{articles_fp.POSTER_CG}&nbsp;[ {articles_fp.TIME} ] - {L_NEWS_SUMMARY}&nbsp;<a href="{articles.U_VIEWS}"><b>{articles.COUNT_VIEWS}</b>&nbsp;{L_NEWS_VIEWS}</a>&nbsp;{L_NEWS_AND}&nbsp;<a href="{articles.U_COMMENT}"><b>{articles.COUNT_COMMENTS}</b>&nbsp;{L_NEWS_COMMENTS}</a>.


OPEN

blocks/blocks_imp_forum_attach.php

FIND
Code: [Download] [Hide] [Select]
'L_ANNOUNCEMENT' => $lang['Post_Announcement'],

AFTER ADD
Code: [Download] [Hide] [Select]
'L_NEWS_SUMMARY' => $lang['News_Summary'],
'L_NEWS_VIEWS' => $lang['News_Views'],
'L_NEWS_AND' => $lang['News_And'],
'L_NEWS_COMMENTS' => $lang['News_Comments'],


With the last modification now I can visualize "this news item has Views and comments" but my poor php knowledge is not enough to find the way to visualize the number of views and comments.

I have tried to apply in blocks_imp_forum_attach.php new code lines like (extracted and adapted from includes/news.php)

Code: [Download] [Hide] [Select]
'U_COMMENTS' => append_sid(VIEWTOPIC_MG . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']),
'U_COMMENT' => append_sid(VIEWTOPIC_MG . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']),
'U_VIEWS' => append_sid('topic_view_users.' . phpEx . '?' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']),


But I don't have a valid result...

Can anyone help me? Thanks!

Subject: Re: Customization Of Forum_attach_block.tpl
Walking through IP php pages and trying to understand the code logic I have found the follow solution for my question!

Here all modifications that I have made:

OPEN

templates/(your_template)/blocks/forum_attach_block.tpl


FIND
Code: [Download] [Hide] [Select]
<td align="left"><span class="gensmall">&nbsp;{articles_fp.POSTER_CG}&nbsp;[ {articles_fp.TIME} ]</span>

REPLACE WITH

Code: [Download] [Hide] [Select]
<td align="left"><span class="gensmall">{articles_fp.POSTER_CG}&nbsp;[ {articles_fp.TIME} ] - {L_NEWS_SUMMARY}&nbsp;<a href="{articles_fp.U_VIEWS}"><b>{articles_fp.COUNT_VIEWS}</b>&nbsp;{L_NEWS_VIEWS}</a>&nbsp;{L_NEWS_AND}&nbsp;<a href="{articles_fp.U_COMMENTS}"><b>{articles_fp.REPLIES}</b>&nbsp;{L_NEWS_COMMENTS}</a>.</span>


OPEN

blocks/blocks_imp_forum_attach.php

FIND
Code: [Download] [Hide] [Select]
'L_ANNOUNCEMENT' => $lang['Post_Announcement'],

AFTER, ADD
Code: [Download] [Hide] [Select]
'L_NEWS_SUMMARY' => $lang['News_Summary'],
'L_NEWS_VIEWS' => $lang['News_Views'],
'L_NEWS_AND' => $lang['News_And'],
'L_NEWS_COMMENTS' => $lang['News_Comments'],

FIND
Code: [Download] [Hide] [Select]
'REPLIES' => $fetchposts[$i]['topic_replies'],

AFTER, ADD
Code: [Download] [Hide] [Select]
'COUNT_VIEWS' => $fetchposts[$i]['topic_views'],
'U_COMMENTS' => append_sid(VIEWTOPIC_MG . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']),
'U_VIEWS' => append_sid('topic_view_users.' . $phpEx . '?' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']),


OPEN

fetchposts.php

FIND
Code: [Download] [Hide] [Select]
t.topic_replies,

IN-LINE AFTER, ADD
Code: [Download] [Hide] [Select]
t.topic_views,

There are three occurrances and I have put the code after all of them (I don't know if it was strictly necessary)

FIND
Code: [Download] [Hide] [Select]
$posts[$i]['topic_replies'] = $row['topic_replies'];

AFTER, ADD
Code: [Download] [Hide] [Select]
$posts[$i]['topic_views'] = $row['topic_views'];

There are two occurrances.

---------------

After all those modifications... the template was functioning correctly!!!! :icy_lol_flag: :icy_lol_flag: :icy_lol_flag:

forum_attach_block_success

Subject: Re: Customization Of Forum_attach_block.tpl
Added to customization section... thanks for sharing. :mricy:


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.9217s (PHP: 2% SQL: 98%)
SQL queries: 15 - Debug Off - GZIP Enabled