Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: thomp4pal on December 08, 2017, 12:28:11 PM

Title: Adding an updateable postpage underneath Boards
Post by: thomp4pal on December 08, 2017, 12:28:11 PM
I have been working on adding a post-page which will seat just immediately underneath Boards, before forum statistics.
the page will be updated daily with recent hot topics in the boards of the forum, bearing hyperlinks to the thread's topic...
So far i've tried using both T.P and S.P even AdkPortal, but this page gets created underneath Forum statistics >:( and other mishaps am not comfortable with.
A little guidance here will be greatly appreciated..

Forum link :  www.unbox9ja.com


Title: Re: Adding an updateable postpage underneath Boards
Post by: Sir Osis of Liver on December 08, 2017, 12:48:10 PM
AFAIK, portals don't edit board index code, they add blocks above, below, and on either side.  Don't have time to look at it now, but you could probably adapt the code from the relevant portal block and place it in a <div> at the location you want it in BoardIndex.template.php.
Title: Re: Adding an updateable postpage underneath Boards
Post by: thomp4pal on December 08, 2017, 01:05:50 PM

Hi Sir Osis of Liver,

Thanks for the reply, I understand this approach clearly, now i have to figure out how to get the code from the relevant portal block...
Title: Re: Adding an updateable postpage underneath Boards
Post by: thomp4pal on December 08, 2017, 03:38:51 PM
Still Not popping out under board.

Done Editing of BoardIndex.template.php and inserting  TinyPortal article block code

BoardIndex.template.php code:


// Show the mark all as read button?
if ($settings['show_mark_read'] && !empty($context['categories']))
template_button_strip($mark_read_button, 'top');

echo '
</div>
</div>';
}

template_info_center();
}

function template_info_center()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;

// Here's where the "Info Center" starts...
echo '
<div class="tborder clearfix" id="infocenterframe">
<h3 class="catbg">


TinyPortal article block code:


div class="tparticle">
<div class="cat_bar">
<h3 class="catbg"><span class="left"></span>{article_shortdate} {article_title} {article_category}</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
{article_avatar}
<div class="article_info">
{article_author}
{article_date}
{article_views}
{article_rating}
{article_options}
</div>
<div class="article_padding">{article_text}</div>
<div class="article_padding">{article_moreauthor}</div>
<div class="article_padding">{article_bookmark}</div>
<div class="article_padding">{article_morelinks}</div>
<div class="article_padding">{article_comments}</div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>


BoardIndex.template.php code after editing:

// Show the mark all as read button?
if ($settings['show_mark_read'] && !empty($context['categories']))
template_button_strip($mark_read_button, 'top');

echo '
</div>
</div>';

div class="tparticle">
<div class="cat_bar">
<h3 class="catbg"><span class="left"></span>{article_shortdate} {article_title} {article_category}</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
{article_avatar}
<div class="article_info">
{article_author}
{article_date}
{article_views}
{article_rating}
{article_options}
</div>
<div class="article_padding">{article_text}</div>
<div class="article_padding">{article_moreauthor}</div>
<div class="article_padding">{article_bookmark}</div>
<div class="article_padding">{article_morelinks}</div>
<div class="article_padding">{article_comments}</div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>

}

template_info_center();
}

function template_info_center()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;

// Here's where the "Info Center" starts...
echo '
<div class="tborder clearfix" id="infocenterframe">
<h3 class="catbg">


After editing, saving and uploading BoardIndex.template.php, still no post or article underneath board...
Title: Re: Adding an updateable postpage underneath Boards
Post by: thomp4pal on December 08, 2017, 03:57:17 PM
should look something like this underneath board  8)
Title: Re: Adding an updateable postpage underneath Boards
Post by: Sir Osis of Liver on December 08, 2017, 09:02:33 PM
I believe you have to have TP installed and running, with that portal block active, that should show it in both locations, then it's a matter of removing the lower block.  I'll tinker with it soon as I get a chance.
Title: Re: Adding an updateable postpage underneath Boards
Post by: Sir Osis of Liver on December 08, 2017, 10:09:59 PM
Ok, got this far -



// Show the mark all as read button?
if ($settings['show_mark_read'] && !empty($context['categories']))
echo '<div class="mark_read">', template_button_strip($mark_read_button, 'right'), '</div>';
}
else
{
echo '
<div id="posting_icons" class="flow_hidden">
<ul class="reset">
<li class="floatleft"><img src="', $settings['images_url'], '/new_none.png" alt="" /> ', $txt['old_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
</ul>
</div>';
}

/// TP recent posts

echo '

<div id="tptopbarHeader" style="' , in_array('tptopbarHeader',$context['tp_panels']) && $context['TPortal']['showcollapse']==1 ? 'display: none;' : '' , 'clear: both;">
' , TPortal_panel('top') , '
</div>

<div id="tplowerbarHeader" style="' , in_array('tplowerbarHeader',$context['tp_panels']) && $context['TPortal']['showcollapse']==1 ? 'display: none;' : '' , '">
' , TPortal_panel('lower') , '</div>';


template_info_center();
}



Displays recent topics block above info center, but only if lower block is activated, so it's displayed twice.  Now have to figure out how to remove lower block.
Title: Re: Adding an updateable postpage underneath Boards
Post by: Sir Osis of Liver on December 08, 2017, 10:23:29 PM
Ok, block has to be active.  In TPBlockLayout.template.php -



function template_tp_below()
{
global $context;

if($context['TPortal']['lowerpanel']!=1)
echo '
<div id="tplowerbarHeader" style="' , in_array('tplowerbarHeader',$context['tp_panels']) && $context['TPortal']['showcollapse']==1 ? 'display: none;' : '' , '">
' , TPortal_panel('lower') , '</div>';



It removes the block below board index, leaves the new one above info center.
Title: Re: Adding an updateable postpage underneath Boards
Post by: thomp4pal on December 09, 2017, 07:24:49 AM
This seems to do the magic, but am not done yet Sir Osis of Liver ;D
Title: Re: Adding an updateable postpage underneath Boards
Post by: Aleksi "Lex" Kilpinen on December 21, 2017, 11:34:18 AM
So, is everything figured out now, or do you still need assistance with something? :)
Title: Re: Adding an updateable postpage underneath Boards
Post by: thomp4pal on December 30, 2017, 12:56:16 PM
Due to Heavy workload and planning on designs i've been off this thread until now, my apologies pls...

And now Situation Report  ;D

Yes the code provided by Sir Osis of Liver did worked like charm however something weird came up after editing TPBlockLayout.template.php

'Forum' starts to appear twice in current position in forum link... (check attached picture) am sure it has to do with Tinyportal, also i noticed that i am redirected to 'Forum' by default each time a user logs in, I sorted that from TP settings (How to redirect after login: >Redirect  to frontpage).  But still 'Forum' still appears double in Current position in forum link...



Title: Re: Adding an updateable postpage underneath Boards
Post by: Sir Osis of Liver on December 30, 2017, 03:32:11 PM
Hmm, the edits shouldn't have affected the menu, I believe it's pulled in with a hook.  Go to the TP support topic (https://www.simplemachines.org/community/index.php?topic=27642.0), Mick will help you with that.  Give him a link to my code above.
Title: Re: Adding an updateable postpage underneath Boards
Post by: Aleksi "Lex" Kilpinen on January 11, 2018, 05:40:35 AM
Quote from: Sir Osis of Liver on December 30, 2017, 03:32:11 PM
Go to the TP support topic (https://www.simplemachines.org/community/index.php?topic=27642.0), Mick will help you with that.  Give him a link to my code above.
Judging from the discussion in the mod's topic, this would appear to be solved.
I'll mark the topic solved, but if the OP still need assistance they are free to mark the topic not solved again. :)