collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 206
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: Re: Enable articles without showing them in portal  (Read 6190 times)

0 Members and 1 Guest are viewing this topic.

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Enable articles without showing them in portal
« on: April 14, 2010, 10:18:45 AM »
yes, i used your modified sp_articles function modified to drop images and bbcodes, i'd like to make it work without articles turned on, but I can't figure how to modify that to take posts only from one or two boards.

I think i can modify that to drop first n posts that will be shown in a board news block.

that's my sp_articles function, can you help me?

Code: [Select]
function sp_articles($parameters, $id, $return_parameters = false)
{
global $smcFunc, $modSettings, $scripturl, $user_info, $txt, $color_profile, $smcFunc, $context, $settings;
// Based on SimplePortal 2.3.1, modified by AngelinaBelle
//
//  * Display articles from all categories, or limit to a single category (code provided by SiNan on Simpleportal forum
//  * Display article title, author, etc. only, or display truncated article text
//  * Truncated article text length (in characters) -- truncation performed by sp_truncatetext
//
// New CSS classes used:
// sp_articles_withbody_title
// sp_articles_author
// sp_articles_body
// sp_articles_more
//
//

//AngelinaBelle -- code for categories provided by SiNaN
global $sourcedir;
require_once($sourcedir . '/Subs-PortalAdmin.php');

$block_parameters = array(
'limit' => 'int',
'type' => 'select',
'image' => 'select',
// [SiNaN] Select all categories, or just one article category (code from SiNaN)
'category' => array(0 => '(Tutte le Categorie)'),
// AngelinaBelle Display message or header only, and truncate message to an integer value
'displaymessage' => 'select',
'hidebbcode' => 'select',
'hideauthor' => 'select',
'hideprnt' => 'select',
'truncate' => 'int'
        );
       

$categories = getCategoryInfo();
foreach ($categories as $category)
$block_parameters['category'][$category['id']] = $category['name'];
$txt['sp_param_sp_articles_category'] = 'Category';

//Ataru -- options for hideimages
   $hidebbcode_Subject='Mostra';
   $hidebbcode_Message='Non mostrare';
//Ataru -- options for hideauthor
   $hideauthor_Subject='Mostra';
   $hideauthor_Message='Non mostrare';
//Ataru -- options for hideprintreadmore
   $hideprnt_Subject='Mostra';
   $hideprnt_Message='Non mostrare';
//AngelinaBelle -- options for displaymessage
   $display_Subject='Solo titolo';
   $display_Message='Titolo e testo dell\'articolo';     
if ($return_parameters)
{

$txt['sp_param_sp_articles_category'] = 'Categoria';

// AngelinaBelle: displaymessage _options are usually set in language/SPortal.<language>.php, while the message is set in the SPortalAdmin language file.
      $txt['sp_param_sp_articles_displaymessage'] = 'Mostra titolo o testo dell\'articolo';
      $helptxt['sp_param_sp_articles_displaymessage'] = 'Mostra solo il titolo (default) o anche il testo del messaggio';
      $txt['sp_param_sp_articles_displaymessage_options'] = $display_Subject . '|' . $display_Message;
//Ataru -- hide images
      $txt['sp_param_sp_articles_hidebbcode_options'] = $hidebbcode_Subject . '|' . $hidebbcode_Message;
//Ataru -- hide author
      $txt['sp_param_sp_articles_hideauthor_options'] = $hideauthor_Subject . '|' . $hideauthor_Message;
//Ataru -- hide printreadmore
      $txt['sp_param_sp_articles_hideprnt_options'] = $hideprnt_Subject . '|' . $hideprnt_Message;

//Ataru -- hide bbcode
      $txt['sp_param_sp_articles_hidebbcode'] = 'BBCode (e immagini) nell\'articolo';
//Ataru -- hide author
      $txt['sp_param_sp_articles_hideauthor'] = 'Autore dell\'articolo';
//Ataru -- hide printreadmore
      $txt['sp_param_sp_articles_hideprnt'] = 'Pulsanti Stampa e Leggi l\'articolo';

//AngelinaBelle -- options for truncate
      $txt['sp_param_sp_articles_truncate'] = 'Taglia l\'articolo';
      $helptxt['sp_param_sp_articles_truncate'] = 'Se รจ stato scelto di mostrare il tersto dell\'articolo, indica il numero di caratteri da visualizzare prima che l\'articolo tagliato';

return $block_parameters;
}
$limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit'];
$type = empty($parameters['type']) ? 0 : 1;
$image = empty($parameters['image']) ? 0 : (int) $parameters['image'];
//AngelinaBelle -- code for categories provided by SiNaN
$category = empty($parameters['category']) ? 0 : (int) $parameters['category'];
//AngelinaBelle
$displaymessage = ( empty($parameters['displaymessage']) ? False : ( ($parameters['displaymessage'] == 1) ? True : False ) );
//Ataru
$hidebbcode = ( empty($parameters['hidebbcode']) ? False : ( ($parameters['hidebbcode'] == 1) ? True : False ) );
$hideauthor = ( empty($parameters['hideauthor']) ? False : ( ($parameters['hideauthor'] == 1) ? True : False ) );
$hideprnt = ( empty($parameters['hideprnt']) ? False : ( ($parameters['hideprnt'] == 1) ? True : False ) );

//AngelinaBelle -- get m.body only if we need m.body. ; $sql_qry used for query string debugging.
$sql_qry='
SELECT
m.id_topic, m.subject, m.poster_name, c.picture, c.name,
' . (!$displaymessage ? '' : 'm.id_msg, m.body, m.smileys_enabled,
') . 'mem.id_member, mem.real_name, mem.avatar,
at.id_attach, at.attachment_type, at.filename
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS at ON (at.id_member = mem.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}' . 
(!empty($category)
? '
AND a.id_category = {int:category}'
: ''
) . '
ORDER BY {raw:type}
LIMIT {int:limit}';

$sql_params = array(
'approved' => 1,
'type' => $type ? 'RAND()' : 'm.poster_time DESC',
'limit' => $limit
);
if (!empty($category)) $sql_params['category'] = $category;

//debug
// echo 'SQL Query <pre>', print_r($sql_qry), "</pre><br/>\n";
// echo 'SQL Params<pre>', print_r($sql_params), "</pre><br/>\n";
// global $db_show_debug;
// $db_show_debug = true;
// if (isset($db_show_debug) && $db_show_debug === true)
// echo 'calling smcFunc with debugging ' ;
// else
// echo "calling smcFunc without debugging";

$request = $smcFunc['db_query']('', $sql_qry, $sql_params);

// echo 'just back from db_query ', "<br/>\n"; //debug

// echo 'request: <pre>', print_r($request),  "</pre><br/>\n";
$articles = array();
$colorids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (!empty($row['ID_MEMBER']))
$colorids[$row['ID_MEMBER']] = $row['ID_MEMBER'];

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

//AngelinaBelle -- use it if you've got it.
censorText($row['subject']);

$articles[] = array(
'id' => $row['id_topic'],
'name' => $row['subject'],
'msg' => ( !$displaymessage ? NULL:
array(
'id' => $row['id_msg'],
'body' => $row['body'],
'smileys_enabled' => $row['smileys_enabled']
)
),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>',
'poster' => array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
),
'image' => array(
'href' => $row['picture'],
'image' => '<img src="' . $row['picture'] . '" alt="' . $row['name'] . '" />',
),
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
),
);

}

$smcFunc['db_free_result']($request);

//debug
// echo "<b>there are ", count($articles), " articles</b> after free_request<br/>";
//AngelinaBelle -- temporarily disable some tags for this block's output (used in call to parse_bbc)
//Make sure to re-enable any tags that have been disabled (?)


$parse_tags = FALSE;
/*


// supressing some tags until things change in parse_bbc.
$supressTags = array(); // 'pdf','pdftest','flash','me'); // add more tags to the list, if you want
if (FALSE) //($supressTags !== array() && is_array($supressTags))
{
$parse_tags = array();
$temp = parse_bbc(FALSE);
foreach ($temp as $k => $code)
if ( ! in_array($code['tag'],$supressTags) ) $parse_tags[]=$code['tag'];
}
*/

//AngelinaBelle -- enable/disable AEVA embedding for this block's output
// AEVA code in parse_bbc disables AEVA if !empty($parse_tags)
$enableaeva=True;
if (array_key_exists('aeva_disable',$context))
{
$realaeva=$context['aeva_disable'];
$context['aeva_disable'] = ($enableaeva ? null : 1);

// echo 'context: realaeva ', $realaeva, "<br/>\n"; //debug
}
elseif (array_key_exists('aeva_enable',$modSettings))
{
$realaeva=$modSettings['aeva_enable'];
$modSettings['aeva_enable'] = ($enableaeva ? 1 : NULL);
// echo 'modSettings: realaeva ', $realaeva, "<br/>\n"; //debug
}
// echo 'modSettings: aeva_enable "', $modSettings['aeva_enable'], '"', "<br/>\n"; //debug


//AngelinaBelle -- if $displaymessage, then parse and (if necessary) truncate the message body
if ($displaymessage)
{

// require_once($sourcedir . '/Subs-Portal.php');
//debug
// echo 'func[strpos] ' , ( (!empty($smcFunc['strpos']) ) ? 'is set ' : 'is not set ') ,  "<br/>\n";
foreach ($articles as $k => $article)
{

// echo "working on article ", $k, "<br/>";  //debug
//  If article has a  tag, truncate there, put ... at the end
//  Else, if article is longer than $paramters['truncate'], truncate, put ... at the end
//  Else, don't truncate. Don't put ... at the end.
//
//
if ($parameters['hidebbcode'])
{
$nobbcode = str_replace("[img]","<",str_replace("[/img]",">",$article['msg']['body']));
$nobbcode = strip_tags(str_replace("[", "<", str_replace("]", ">", $nobbcode)));
$article['msg']['body'] = $nobbcode;
}

if (($cutoff = $smcFunc['strpos']($article['msg']['body'], '')) !== false)
$putdots =
  (
   (
     $cutoff <
      ($smcFunc['strlen']($article['msg']['body']) - $smcFunc['strlen']('')
      )
    )
  ? TRUE
  : FALSE
  );
elseif (!empty($parameters['truncate']) && $smcFunc['strlen']($article['msg']['body']) > $parameters['truncate'] )
{
$cutoff = $parameters['truncate'];
$putdots = TRUE;
}
else
{
$cutoff = FALSE;
$putdots = FALSE;
}
// echo 'cutoff ', (($cutoff === False) ? 'FALSE' : $cutoff ), "<br/>\n" ; //debug
// echo 'putdots ', (($putdots) ? 'TRUE' : 'FALSE' ), "<br/>\n"; //debug

if ( $cutoff !== FALSE )
//modifiche di ataru
// $article['msg']['body'] = $smcFunc['substr']($article['msg']['body'], 0, $cutoff);
// echo 'parsing article ', $k , "<br/>\n";//debug
// $article['msg']['body'] = parse_bbc($article['msg']['body'], $article['msg']['smileys_enabled'], $article['msg']['id'], $parse_tags);
{
$cut_string=substr($article['msg']['body'], 0,$cutoff);
$last_space=strrpos($cut_string," ");
$article['msg']['body']=substr($cut_string, 0,$last_space);
}

if ($putdots)
$article['msg']['body'] .= ' (<a href="'.$article['href'].'">...</a>)';

censorText($article['msg']['body']);

if ($modSettings['sp_resize_images'])
$article['msg']['body'] = preg_replace('~<img\s+src="([^"]+)"([^/>]+)/>~i', '<img src="$1"$2class="sp_article" />', $article['msg']['body']);
// I could come up with the correct preg_replace for <embed and <object, too. Perhaps another day.


//debug
// echo "<b>there are ", count($articles), " articles </b> after truncation<br/>";

$articles[$k]['msg']['body'] = $article['msg']['body'];
}
//debug
// echo "<b>there are ", count($articles), "articles </b> after foreach $articles <br/>";

//AngelinaBelle -- done parsing and truncating message bodies


//AngelinaBelle -- put AEVA settings back the way they were

if (array_key_exists('aeva_disable',$context))
{
// echo 'context: aeva_disable ', $context['aeva_disable'], "<br/>\n" ;//debug
$context['aeva_disable'] = $realaeva;
}
elseif (array_key_exists('aeva_enable',$modSettings))
{
// echo 'modsettings: aeva_enable "', $modSettings['aeva_enable'], '"', "<br/>\n" ; //debug
$modSettings['aeva_enable'] = $realaeva;
}


}

if (empty($articles))
{
echo '
', $txt['error_sp_no_articles_found'];
return;
}
else
$articles[count($articles) - 1]['is_last']=True;

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($articles as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$articles[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}

//Begin article list output. Original code comes first
if ( !$displaymessage )

if (empty($image))
{
echo '
<ul class="sp_list">';
foreach ($articles as $article)
echo '
<li>', sp_embed_image('topic'), ' ', $article['link'], '</li>';

echo '
</ul>';
}
else
{
echo '
<table class="sp_fullwidth sp_articles">';
foreach ($articles as $article)
{
echo '
<tr>
<td class="sp_articles sp_center">';

if (!empty($article['avatar']['href']) && $image == 1)
echo '<img src="', $article['avatar']['href'], '" alt="', $article['poster']['name'], '" width="40" />';
elseif (!empty($article['image']['href']) && $image == 2)
echo '<img src="', $article['image']['href'], '" alt="', $article['name'], '" width="40" />';

echo '</td>
<td>';
if (!$hideauthor)
{
echo '
<span class="sp_articles_title">', $article['poster']['link'], '</span><br />';
}
echo '
', $article['link'], '
</td>
</tr>';
}

echo '
</table>';
}
}
else
{  //AngelinaBelle -- new displaymessage option -- display truncated message.
// echo "there are ", count($articles), "articles <br/>";
echo '
<table class="sp_fullwidth sp_articles">';

foreach ($articles as $article)
{
echo '
<tr><td>
';
// echo '<div>', "\n";


if (empty($image)) {}
else
{
if (!empty($article['avatar']['href']) && $image == 1)
$img_guts = $article['avatar']['href'] .  '" alt="' .  $article['poster']['name'];
elseif (!empty($article['image']['href']) && $image == 2)
$img_guts = $article['image']['href'] . '" alt="' .  $article['name'];

if ( isset($img_guts) && !empty($img_guts) )
echo '<img class="sp_articles_icon" src="', $img_guts, '" width="40" /></td>';
}
echo '<td>';
//link to print article
if (!$hideprnt)
{
echo '    <div style="float: right;" class="sp_articles_more"> <a href="', $article['href']. ';action=printpage', '">Stampa</a>', "</div>\n";
}

//article title
// echo '    <p class="sp_articles_withbody_title">';
echo  $article['link'] ;
// echo  '</p>', "\n";
//byline
if (!$hideauthor)
{
echo '     <span class="sp_articles_author">', $txt[525], ' ', $article['poster']['link'], '    </span>';
}

//date and time
// $article['time'], // Let's leave this out for now.

// Begin Truncated Message Body
echo '<div class="sp_articles_body">', $article['msg']['body'], '</div>';

if (!$hideprnt)
{
// More and comment links after message
echo '<table width="100%">'. "\n<tr>";
//Another link to the article
echo '<td><span class="sp_articles_more"> <a href="', $article['href'], '">Leggi l\'articolo</a></span></td>'. "\n";
//comments
echo '<td><span class="sp_articles_more"> <a href="', $article['href']. ';action=post' , '">',
( ($txt['ssi_write_comment']==='') ? Comment : $txt['ssi_write_comment'])
, '</a></span></td>', "\n";
echo "</tr>\n</table>" , "\n";
}

// A separator if this is not the last article
if ( empty($article['is_last'])) echo '
<hr />';
echo '</td></tr>' . "\n";
}
echo "</table>\n";
// handle sp_resize-ing.
// at this point, it is too late to alter the header in php, so we'll have to do it in js.
// This css file should contain resize directives for embed and object only, since many
// browsers don't follow the rules for max-height and max-width.
if ($modSettings['sp_resize_images'])
{
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var cssNode = document.createElement("link");
cssNode.type = "text/css";
cssNode.rel = "stylesheet";
cssNode.href = "', $settings['default_theme_url'], '/portal_resize.css";
cssNode.media = "screen";
cssNode.title = "dynamicLoadedSheet";
document.getElementsByTagName("head")[0].appendChild(cssNode);
// ]]></script>';
}

}

}

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Re: Enable articles without showing them in portal
« Reply #1 on: April 14, 2010, 12:09:33 PM »
(This topic is a continuation of the discussion that began at http://simpleportal.net/index.php?topic=5174.msg31250#msg31250 )
---------------------------------------------------------------------
I am not sure I understand.
You are talking about turning articles off and mixing together the functions of sp_articles and BoardNews.
This sounds very difficult to me.
 
If I needed to turn off sportal_article output on the front page off, I would switch to using Board News. It is very easy to get Board News to draw from one or two boards. You can make sure that only "approved" posts go on these boards.

You might be able to accomplish some of the formatting in a CSS file, but you can also use the same kind of custom formatting you've been using in sp_articles in your own customized BoardNews block.
 
How would you feel about working with a customized BoardNews instead of customized sp_articles?
 
I'm going to stick with you on this. I have split this topic and moved the customization discussion to customization.
« Last Edit: April 14, 2010, 12:23:00 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Enable articles without showing them in portal
« Reply #2 on: April 14, 2010, 01:35:59 PM »
Here's a suggestion I got from [SiNaN]
 
It will be useful to you if you want to use your customized sp_articles block on the portal page, but not see the sportal_articles on the page.
 
You will have to re-fix this and your custom sp_articles with every SimplePortal update.
 
Sources/PortalArticles.php

Code: (Find) [Select]
   if (empty($modSettings['articleactive']))
Code: (Replace) [Select]
   $modSettings['articleactive'] = false;
   if (empty($modSettings['articleactive']))
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Re: Enable articles without showing them in portal
« Reply #3 on: April 15, 2010, 11:40:14 AM »
ok, got it to turn off sportal_articles in portal page.

i'd like, effectively, to have the modified function of sp_articles and the board news, without articles turned on.
but if that's difficult, i use articles as well, hoping to have in next version the possibility to give to news section moderators the permission to set posts as articles.

thanks!

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Enable articles without showing them in portal
« Reply #4 on: April 15, 2010, 12:53:22 PM »
I am not sure I follow you, but I will try. Please let me know if I have misunderstood.
 
1) If you want to have articles from only one board on the page, you can create a special category, and only display that one category. Then, "someone" can decide which topics on that board are worthy to be articles, and be sure they go in the appropriate category.
PROS:
- Not all topics from the board will be displayed -- only the articles
- Not all articles will be displayed -- only the ones from the one category
- You get the format you have customized in sp_articles.
CONS:
- If nobody chooses articles, nothing new ever shows up.
- With the customized sp_articles, you can display all categories or just 1, but not 2 or 3.
- You need to create a membergroup, perhaps "article moderators" with permission to promote topics to articles
- You need to educate these moderators to put articles in the correct categories
 
2) You can just use BoardNews, choosing only one board to display on the portal
PROS:
- It's simpler. Board moderators don't have to fiddle with the articles system on top of the forum moderation
- It's simpler. You don't have to create an "article moderators" group on top of global and per-board moderators.
- It's simpler. As soon as a new topic goes on the board, it shows up on the portal.
CONS:
- To keep a topic off the BoardNews, you have to move it to a different board
- As soon as a new topic goes on the board, it shows up on the portal
- To get your preferred display format, you'll have to fiddle with CSS files, and you may even wind up customizing the BoardNews code like you did the sp_articles code.
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline ataru

  • Jr. Member
  • **
  • Posts: 63
  • Gender: Male
    • Biancocelesti.org - Sempre Forza Lazio
  • SMF Version: 2.0.10
  • SP Version: 2.3.6
Re: Enable articles without showing them in portal
« Reply #5 on: April 16, 2010, 05:37:59 AM »
you got it...

I could use Boardnews. in fact i take news only from the "news" board, read only and moderated by articles writers. after writing an article, they lock the discussion and that's my news board.

but you tell me it's very difficult to make a block similar to modified sp_articles reading only from a single board, isn't it?

if so, i have to give news moderators permissions and instructions to promote topics to articles.
but they could promote to articles also topics from other boards, and i don't want it.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Enable articles without showing them in portal
« Reply #6 on: April 16, 2010, 02:11:43 PM »
I'm glad I understand you now! Before, I thought you wanted to put boardnews stuff in function sp_articles(). I didn't like the thought of working on something like that!
 
I think it will not be too hard to fool with BoardNews.
Not any harder than what you've done to sp_articles.
Still, every time you upgrade SimplePortal, you would have to maintain your new version of BoardNews and the changes to portal.css.
[SiNaN] has said some future version of SimplePortal will have a major improvements for controlling how your blocks look. http://simpleportal.net/index.php?topic=5033.msg30550#msg30550
I am looking forward to that.
 
I'm not a SimplePortal developer, but I will help where I can.
 
Here's how I think I would approach this:
1) Make some slight changes to the BoardNews block to give you new CSS classes for the header and the body.  I cannot find any way to distinguish the <h3 class="catbg"> that heads the boardnews items from the ones within <td id="sp_center"> (when a CURVE-type theme is used -- different html comes out with a core-compatable theme)
2) Add the appropriate styles to portal.css
3) Finally, make another small change to boardnews.css to control the BBC. This can be selective, to allow bold, but turn off images, for example.
 
OK?

Step 1: new CSS classes for boardnews output
I think you can find the boardnews function in Portalblocks.php.
The parts of the code you want to target are
Code: (find) [Select]
<h3 class="catbg">
Code: (replace) [Select]
<h3 class="sp_boardnews_head">
Code: (find) [Select]
     <div class="windowbg">
Code: (replace) [Select]
     <div class="sp_boardnews_body">

Step 2: customize in portal.css
Once you have these new classes in your code, you can add some stuff to portal.css, if you like, to customize the appearance.
 
Code: [Select]
h3.sp_boardnews_head
{
  border-top: 1px solid black;
}
div.sp_boardnews_body
{
}
 

Step 3: Control BBCode
In my customized sp_articles block, you can see that I have commented out some code to supress certain BBC tags.  The last time I checked, it worked OK. You can give it a try.  This is how the shoutbox allows bold but not glow.
 
« Last Edit: April 16, 2010, 03:12:31 PM by AngelinaBelle »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?