Block to show recen...
 
Notifications
Clear all

Block to show recent topics on SMF message board (not bridged)

6 Posts
3 Users
0 Reactions
2,408 Views
(@livia)
Posts: 30
Eminent Member
Topic starter
 

I would like to create a block for eFiction that shows the recent topics on my SMF message board. The two scripts are not bridged.

Now, I know how to initialise a block; as for SMF, the code to show recent topics is this one:

<?php 
require_once('path/to/mboard/SSI.php');
$posts = ssi_recentTopics();
?>

However, I don't know how to put it in the script of the block to make the block display the recent topics.
I would be grateful to anyone who's willing to help me.
Thanks in advance  πŸ™‚


URL to your eFiction: http://www.acciofanfiction.com/index.php
Your version of eFiction: 3.5.1 (Italian language)
Version of PHP: 4.4.8
Version of MySQL: 4.1.22

 
Posted : 11/09/2007 2:36 pm
(@calash)
Posts: 180
Estimable Member
 

For a very basic block you will need 2 files.

The first is the init.php file.  It adds the block into the database, setting the path to the main php file, giving it a name and title.

For this example I am going to say that the block folder is /blocks/smfthread/,the main file smfthread.php.  The init.php would look something like this.


if(!defined("_CHARSET")) exit( );
dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_blocks(`block_name`, `block_title`, `block_status`, `block_file`, `block_variables`) VALUES('smfthread', 'Recent Threads', '0', 'smfthread/smfthread.php', '');");

This is the code that gets run in the admin panel to activate the block.  Then you will need the main code for the block.  As I remember, the ssi.php function outputs basic HTML, so we should be able to use something like this for smfthread.php


require_once('path/to/mboard/SSI.php');
$content .= ssi_recentTopics();

Now, in your skin you will need to include the 2 tpl variables, {smfthread_title} and {smfthread_content}.  Then go to your admin panel, initalize the block and set it to active (1 or 2, depending on where you need this content displayed) and it should work.

THis is a bit simplified, you can also include an admin.php, language.php for translations.


The World of Necrotania - Story Writing Community

 
Posted : 11/09/2007 3:18 pm
(@fanfictionworld)
Posts: 149
Estimable Member
 

hmm I'd also like something like this but for IPB v1.3 final so im open to ideas if anyone has got any :p


~Spikey~

my site url: http://www.fanfictionworld.org
efic version:3.5.3

 
Posted : 11/09/2007 3:44 pm
(@livia)
Posts: 30
Eminent Member
Topic starter
 

Hi calash, thank you very much for your response.


require_once('path/to/mboard/SSI.php');
$content .= ssi_recentTopics();

Now, in your skin you will need to include the 2 tpl variables, {smfthread_title} and {smfthread_content}.  Then go to your admin panel, initalize the block and set it to active (1 or 2, depending on where you need this content displayed) and it should work.

THis is a bit simplified, you can also include an admin.php, language.php for translations.

Unfortunately, I've already tried it this way, and the recent topics doesn't show in the block, but at the top of the page, while the block displays only the block's title.


URL to your eFiction: http://www.acciofanfiction.com/index.php
Your version of eFiction: 3.5.1 (Italian language)
Version of PHP: 4.4.8
Version of MySQL: 4.1.22

 
Posted : 11/09/2007 4:24 pm
(@calash)
Posts: 180
Estimable Member
 

Ack....my bad.  Been a while since I played with SMF πŸ™‚

The default function send the output via ECHO, that is why it is bypassing the block and displaying to the top of the page.  I do not have a copy of SSI.PHP to play with, but I think you can change the output method to array by doing the following


$topics = ssi_recentTopics(output='array');

Then you will have to loop through the array and populate $content with the formatted code.  You should be able to copy the loop from SSI.php and just replace the echo statements with $content .=.

Without the SSI.php I am a bit in the dark though....you are on the right track, it is just a matter of formatting the output.


The World of Necrotania - Story Writing Community

 
Posted : 11/09/2007 5:14 pm
(@livia)
Posts: 30
Eminent Member
Topic starter
 

Thank you so much, calash, that was very helpful!  πŸ™‚


URL to your eFiction: http://www.acciofanfiction.com/index.php
Your version of eFiction: 3.5.1 (Italian language)
Version of PHP: 4.4.8
Version of MySQL: 4.1.22

 
Posted : 12/09/2007 2:53 pm
Share: