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: 373
  • 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]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Block with links to topics of chosen board  (Read 18400 times)

0 Members and 1 Guest are viewing this topic.

jelence

  • Guest
Block with links to topics of chosen board
« on: April 16, 2011, 06:00:40 AM »

Hello!
Is it possible to make custom php block (or to change board news or recent posts/topics) to look like list of links from chosen board?

for example, to look like:

Name of block

Link to topic 1
Link to topic 2
Link to topic 3

and so on?

Thanks!

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Block with links to topics of chosen board
« Reply #1 on: April 18, 2011, 08:42:15 AM »
Yes. This is essentially creating an index of one board. This idea is very similar to the navigation block, which very much needs updating to SMF 2.0.
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?

jelence

  • Guest
Re: Block with links to topics of chosen board
« Reply #2 on: April 18, 2011, 11:23:02 AM »

Thanks.
I suppose that it should be something similar to code in this topic: http://simpleportal.net/index.php?topic=8653.0, only for smf2?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Block with links to topics of chosen board
« Reply #3 on: April 19, 2011, 08:22:10 AM »
The poster reported that this solution worked well:
http://simpleportal.net/index.php?topic=8653.msg46252#msg46252
 
Does that work for you?
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?

jelence

  • Guest
Re: Block with links to topics of chosen board
« Reply #4 on: April 19, 2011, 03:50:28 PM »

He is using  smf1 and it does not work for smf2.

I get this error message when I try his code:

Quote
Fatal error: Call to undefined function db_query() in /home8/asekonom/public_html/Sources/PortalBlocks.php(3351) : eval()'d code on line 17

I don't know how to fix that  :'(.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #5 on: April 21, 2011, 05:48:58 AM »
You can use this in a Custom PHP block:

Code: [Select]
global $db_prefix, $scripturl;

$id_board = 1;

$request = db_query("
SELECT t.ID_TOPIC, m.subject
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
WHERE t.ID_BOARD = {$id_board}
ORDER BY m.subject", __FILE__, __LINE__);
$topics = array();
while ($row = mysql_fetch_assoc($request))
$topics[$row['ID_TOPIC']] = $row['subject'];
mysql_free_result($request);

echo '
<ul>';

if (empty($topics))
{
echo '
<li>There aren\'t any topics.</li>';
}
else
{
foreach ($topics as $id => $subject)
echo '
<li><a href="', $scripturl, '?topic=', $id, '.0">', $subject, '</a></li>';
}

echo '
</ul>';

Change $id_board as the id of the board you want to fetch topics from.
And slowly, you come to realize... It's all as it should be...

jelence

  • Guest
Re: Block with links to topics of chosen board
« Reply #6 on: April 22, 2011, 02:04:19 AM »

Hello [SiNaN], thanks for responding!

I tried code you gave me and I get this error :

Quote
Fatal error: Call to undefined function db_query() in /home8/asekonom/public_html/Sources/PortalBlocks.php(3351) : eval()'d code on line 5

 :(...

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #7 on: April 22, 2011, 09:37:34 AM »
Sorry. For some weird reason I thought you were using SMF 1.1. Try this one:

Code: [Select]
global $smcFunc, $scripturl, $modSettings;

$id_board = 1;

$request = $smcFunc['db_query']('', '
SELECT t.id_topic, m.subject
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE t.id_board = {int:board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:approved}
AND m.approved = {int:approved}' : '') . '
ORDER BY m.subject',
array(
'board' => $id_board,
'approved' => 1,
)
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topics[$row['id_topic']] = $row['subject'];
$smcFunc['db_free_result']($request);

echo '
<ul>';

if (empty($topics))
{
echo '
<li>There aren\'t any topics.</li>';
}
else
{
foreach ($topics as $id => $subject)
echo '
<li><a href="', $scripturl, '?topic=', $id, '.0">', $subject, '</a></li>';
}

echo '
</ul>';
And slowly, you come to realize... It's all as it should be...

jelence

  • Guest
Re: Block with links to topics of chosen board
« Reply #8 on: April 22, 2011, 11:47:14 AM »
This is working great  :thumbsup:!!
Thanks [SiNaN]    :)!

Perhaps this should be a part of standard SP installation?
As far as I can see, there is a lot of people trying to use Recent Posts/Topics for this purpose.
With possibility to put 10 or 20 last topics instead of all of them, it should do the job!




« Last Edit: April 22, 2011, 11:55:44 AM by jelence »

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #9 on: April 22, 2011, 12:06:57 PM »
If you want to limit the topics:

Code: (Find) [Select]
ORDER BY m.subject',
Code: (Replace) [Select]
ORDER BY m.subject
LIMIT {int:limit}',

Code: (Find) [Select]
'approved' => 1,
Code: (Replace) [Select]
'approved' => 1,
'limit' => 10,

If you want to change the sort order to the newest first:

Code: (Find) [Select]
ORDER BY m.subject
Code: (Replace) [Select]
ORDER BY t.id_topic DESC
And slowly, you come to realize... It's all as it should be...

jelence

  • Guest
Re: Block with links to topics of chosen board
« Reply #10 on: April 23, 2011, 02:34:13 AM »
 
 This solved a lot of my 'problems', thanks again  :applause:!

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #11 on: April 24, 2011, 07:54:45 AM »
You're welcome. ;)
And slowly, you come to realize... It's all as it should be...

Offline natasa

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Female
    • Bastica
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #12 on: December 04, 2011, 08:20:31 AM »
Hello!

I really like this modification  :thumbsup:.
And have a question: how to 'center' it ?
It is a bit moved on right side of menu, so when menu is on the left it does not look so good.
And, how can I put my own images instead of black bullets on the beginning of each item on the list?

I tried to do this on my own, but no luck.

Offline natasa

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Female
    • Bastica
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #13 on: June 18, 2013, 12:28:17 AM »
OK, this can be done like this, for example:

Code: [Select]
global $scripturl;

$pages = sportal_get_pages(null, true);

echo '
<p>';

foreach ($pages as $page)
echo '
<p><img src="http://probe.serbianpress.com/Themes/default/images/sp/dot5.png"/>   <a href="', $scripturl, '?page=', $page['page_id'], '">', $page['title'], '</a></p>';

echo '
</p>';

Offline natasa

  • Jr. Member
  • **
  • Posts: 57
  • Gender: Female
    • Bastica
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #14 on: June 23, 2013, 01:08:06 AM »
For boards:

Code: [Select]
global $smcFunc, $scripturl, $modSettings;

$id_board = 1;

$request = $smcFunc['db_query']('', '
SELECT t.id_topic, m.subject
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE t.id_board = {int:board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:approved}
AND m.approved = {int:approved}' : '') . '
ORDER BY m.subject',
array(
'board' => $id_board,
'approved' => 1,
)
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topics[$row['id_topic']] = $row['subject'];
$smcFunc['db_free_result']($request);

echo '
<p style="list-style-type: none; padding-left:20px;">';

if (empty($topics))
{
echo '
<p>There aren\'t any topics.</p>';
}
else
{
foreach ($topics as $id => $subject)
echo '
<p><img src="http://probe.serbianpress.com/Themes/default/images/sp/dot6.png"/>   <a href="', $scripturl, '?topic=', $id, '.0">', $subject, '</a></p>';
}

echo '
</p>';

Offline Tonymura

  • Semi Newbie
  • *
  • Posts: 37
  • Gender: Male
  • Its always a good day when you learn something new
  • SMF Version: 2.0.9
Re: Block with links to topics of chosen board
« Reply #15 on: November 25, 2014, 02:56:54 PM »
Hi
I have a similar question to ask as the one posted right here. Should i start a new topic?
And I looked into the eyes of our beloved Saint Pope John Paul the II for a sign of his blessing to my new mod and quietly he utters the silent word beneath his breath…..”Go away noob”

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Block with links to topics of chosen board
« Reply #16 on: November 28, 2014, 04:47:14 PM »
That would be better indeed.
And slowly, you come to realize... It's all as it should be...