Help - Search - Members - Calendar
Full Version: Auto Transfer Topic Titles To Main Website Page
Invision Power Services > Community Forums > Community Web Design and Coding
snakerpg
for example: http://www.skryer.com/

has those set of tabs showing their latest topics added to the board.

Is there anyw ay I can automaticly get the newest topic titles shown on a normal webpage?

thank you
briansol
ssi.php is your friend. it comes with IPB
snakerpg
QUOTE(briansol @ Apr 3 2006, 01:22 PM) *
ssi.php is your friend. it comes with IPB


could you give me some more info about it and how to use it please?
Shmohel
There is a very good integration mod that you can download and play around with.

http://www.ipsbeyond.com/forums/index.php?...oads&showfile=6

If you install this, it allows you to call a whole boatload of functions from any part of your website to get the IPB info. I use it so I can build my site around the IPB member database, but you can use it for puling back topics and posts too.
briansol
QUOTE(snakerpg @ Apr 3 2006, 01:55 PM) *
could you give me some more info about it and how to use it please?


after you unzip your installation, find:

ipb_c_2_1_5\Tools_and_Scripts

in that folder, there is an ssi.php file.

upload that to your fourms root ie, yoursite.com/forums/ssi.php

open it up with note pad, and there's instructions on how to use it. Basically, you place a php include on your homepage
snakerpg
QUOTE(briansol @ Apr 4 2006, 12:51 AM) *
after you unzip your installation, find:

ipb_c_2_1_5\Tools_and_Scripts

in that folder, there is an ssi.php file.

upload that to your fourms root ie, yoursite.com/forums/ssi.php

open it up with note pad, and there's instructions on how to use it. Basically, you place a php include on your homepage



I did what you say, but since I'm a noob, I aint even close to what i want.

so I added everything, and I open the ssi.php file to read instructions, I guess what i want to become, is in the section below:

+--------------------------------------------------------------------------
| RSS / XML Syndication..
+--------------------------------------------------------------------------

RSS: http://domain.com/forums/ssi.php?a=out&f=1...how=10&type=rss
XML: http://domain.com/forums/ssi.php?a=out&f=1...how=10&type=xml

Will show last 10 topics in reverse chronological last post date order from
all the forums in the comma separated list


when I open all the other url's in the description, I get a nice display page with a frame and the data in it, when I open this url (the one I need to use I think) I get this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE ipbsource (View Source for full doctype...)>
- <ipbsource>
- <topic id="1">
<title>Welcome</title>
<lastposter id="1">Exodus</lastposter>
<starter id="1">Exodus</starter>
<forum id="2">A Test Forum</forum>
<date timestamp="1142279419">Mar 13 2006, 08:50 PM</date>
</topic>
</ipbsource>


is that normal? If yes, how do I edit the url or file, to get me something like this:

Click to view attachment

Last proble is:

lets say I get a page containing this info on the url: XML: http://domain.com/forums/ssi.php?a=out&f=1...how=10&type=xml

then how do I get it displayed on my site's main page? Also updated, like some kind of auto transfer thing that updates automaticly?

Thanks in advance
briansol
no, you don't want an RSS feed to your own page.

Basically, you need to use the news export, but tweak it to get it from all forums.


find function auto_run()

add a new case:

CODE
case 'recent':
                $this->do_recent();
                break;



then add the function...


CODE
/**
    * Do Recent
    *
    * Shows recent posts
    */
    function do_recent()
    {
        
        
        //----------------------------------------
        // INIT
        //----------------------------------------
        
        $perpage = intval($this->ipsclass->input['show']) > 0 ? intval($this->ipsclass->input['show']) : 15;
        $perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;
        $to_echo = "";
        
        //----------------------------------------
        // Get post parser
        //----------------------------------------
        
        require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
        $parser                      =  new parse_bbcode();
        $parser->ipsclass            =& $this->ipsclass;
        $parser->allow_update_caches = 0;
        
        //-----------------------------------------
        // Load the template...
        //-----------------------------------------
        
        $template = $this->load_template("recent.html");
            
        //-----------------------------------------
        // Get the topics, member info and other stuff
        //-----------------------------------------
        
        $this->ipsclass->DB->build_query( array( 'select'   => 't.*',
                                                 'from'     => array( 'topics' => 't' ),
                                                 'where'    => "t.forum_id NOT IN(4,15) AND t.approved=1",
                                                 'order'    => 't.tid DESC',
                                                 'limit'    => array( 0, $perpage ),
                                                 'add_join' => array( 0 => array( 'select' => 'm.members_display_name as member_name, m.mgroup, m.id as member_id,m.title as member_title',
                                                                                  'from'   => array( 'members' => 'm' ),
                                                                                  'where'  => "m.id=t.starter_id",
                                                                                  'type'   => 'left' ),
                                                                      1 => array( 'select' => 'p.*',
                                                                                  'from'   => array( 'posts' => 'p' ),
                                                                                  'where'  => "t.topic_firstpost=p.pid",
                                                                                  'type'   => 'inner' )  )
                                        )      );
        
        $this->ipsclass->DB->exec_query();
        
        while ( $row = $this->ipsclass->DB->fetch_row() )
        {
            
            
            $parser->parse_html  = ( $this->ipsclass->cache['forum_cache'][ $row['forum_id'] ]['use_html'] and $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
            $parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
            
            $row['post']         = $parser->pre_display_parse( $row['post'] );
            $row['member_name']  = $row['member_name'] ? $row['member_name'] : $row['author_name'];
            
            $to_echo .= $this->parse_template( $template,
                                                         array (
                                                                  'profile_link'   => $this->ipsclass->base_url."?act=Profile&CODE=03&MID=".intval($row['member_id']),
                                                                  'member_name'    => $row['member_name'],
                                                                  'post_date'      => $this->ipsclass->get_date( $row['post_date'], 'LONG', 1 ),
                                                                  'topic_title'    => substr($row['title'],0,22) . "...",
                                                                  'topic_title_hover'    => $row['title'],
                                                                  'post'           => $row['post'],
                                                                  'comments'       => $row['posts'],
                                                                  'view_all_link'  => $this->ipsclass->base_url."?showtopic={$row['tid']}"
                                                               )
                                                         );
        }
        
        //-----------------------------------------
          // Get the macros and replace them
          //-----------------------------------------
          
          if ( is_array( $this->ipsclass->skin['_macros'] ) )
          {
            foreach( $this->ipsclass->skin['_macros'] as $i => $row )
            {
                if ( $row['macro_value'] != "" )
                {
                    $to_echo = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $to_echo );
                }
            }
        }
        
        $to_echo = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $to_echo );
        $to_echo = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir']  , $to_echo );
            
        echo $to_echo;
        
        exit();
    }



note in the above: 'where' => "t.forum_id NOT IN(4,15) AND t.approved=1",

forums 4 and 15 are my private forums. replace with yours, or remove that whole not in statement.


and finally, the template...


in ssi_templates/ create a file called recent.html and paste in the following:

CODE
&nbsp;<a href='{view_all_link}' title='{topic_title_hover}'>{topic_title}</a><br />



thats all there is too it.

now, on your home page, you want to simply php include it.

Make it look nice like this:

CODE
<h3>Recent Topics</h3>


        <p style="margin:0; padding: 0 5px 5px 2px; line-height: 18px;">
        <?php
            include("http://www.yoursite.com/forums/ssi.php?a=recent&amp;show=15");
        ?>
        &nbsp;<a href="/forums/index.php?act=Search&amp;CODE=getnew">New posts since last visit</a>    
        </p>



you can tweak the template to pass in more things. A lot of post info gets pulled in the php function.
snakerpg
QUOTE(briansol @ Apr 4 2006, 03:21 PM) *
no, you don't want an RSS feed to your own page.

Basically, you need to use the news export, but tweak it to get it from all forums.
find function auto_run()

add a new case:

CODE
case 'recent':
                $this->do_recent();
                break;

then add the function...
CODE
/**
    * Do Recent
    *
    * Shows recent posts
    */
    function do_recent()
    {
        
        
        //----------------------------------------
        // INIT
        //----------------------------------------
        
        $perpage = intval($this->ipsclass->input['show']) > 0 ? intval($this->ipsclass->input['show']) : 15;
        $perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;
        $to_echo = "";
        
        //----------------------------------------
        // Get post parser
        //----------------------------------------
        
        require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
        $parser                      =  new parse_bbcode();
        $parser->ipsclass            =& $this->ipsclass;
        $parser->allow_update_caches = 0;
        
        //-----------------------------------------
        // Load the template...
        //-----------------------------------------
        
        $template = $this->load_template("recent.html");
            
        //-----------------------------------------
        // Get the topics, member info and other stuff
        //-----------------------------------------
        
        $this->ipsclass->DB->build_query( array( 'select'   => 't.*',
                                                 'from'     => array( 'topics' => 't' ),
                                                 'where'    => "t.forum_id NOT IN(4,15) AND t.approved=1",
                                                 'order'    => 't.tid DESC',
                                                 'limit'    => array( 0, $perpage ),
                                                 'add_join' => array( 0 => array( 'select' => 'm.members_display_name as member_name, m.mgroup, m.id as member_id,m.title as member_title',
                                                                                  'from'   => array( 'members' => 'm' ),
                                                                                  'where'  => "m.id=t.starter_id",
                                                                                  'type'   => 'left' ),
                                                                      1 => array( 'select' => 'p.*',
                                                                                  'from'   => array( 'posts' => 'p' ),
                                                                                  'where'  => "t.topic_firstpost=p.pid",
                                                                                  'type'   => 'inner' )  )
                                        )      );
        
        $this->ipsclass->DB->exec_query();
        
        while ( $row = $this->ipsclass->DB->fetch_row() )
        {
            
            
            $parser->parse_html  = ( $this->ipsclass->cache['forum_cache'][ $row['forum_id'] ]['use_html'] and $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
            $parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
            
            $row['post']         = $parser->pre_display_parse( $row['post'] );
            $row['member_name']  = $row['member_name'] ? $row['member_name'] : $row['author_name'];
            
            $to_echo .= $this->parse_template( $template,
                                                         array (
                                                                  'profile_link'   => $this->ipsclass->base_url."?act=Profile&CODE=03&MID=".intval($row['member_id']),
                                                                  'member_name'    => $row['member_name'],
                                                                  'post_date'      => $this->ipsclass->get_date( $row['post_date'], 'LONG', 1 ),
                                                                  'topic_title'    => substr($row['title'],0,22) . "...",
                                                                  'topic_title_hover'    => $row['title'],
                                                                  'post'           => $row['post'],
                                                                  'comments'       => $row['posts'],
                                                                  'view_all_link'  => $this->ipsclass->base_url."?showtopic={$row['tid']}"
                                                               )
                                                         );
        }
        
        //-----------------------------------------
          // Get the macros and replace them
          //-----------------------------------------
          
          if ( is_array( $this->ipsclass->skin['_macros'] ) )
          {
            foreach( $this->ipsclass->skin['_macros'] as $i => $row )
            {
                if ( $row['macro_value'] != "" )
                {
                    $to_echo = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $to_echo );
                }
            }
        }
        
        $to_echo = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $to_echo );
        $to_echo = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir']  , $to_echo );
            
        echo $to_echo;
        
        exit();
    }

note in the above: 'where' => "t.forum_id NOT IN(4,15) AND t.approved=1",

forums 4 and 15 are my private forums. replace with yours, or remove that whole not in statement.
and finally, the template...
in ssi_templates/ create a file called recent.html and paste in the following:

CODE
&nbsp;<a href='{view_all_link}' title='{topic_title_hover}'>{topic_title}</a><br />

thats all there is too it.

now, on your home page, you want to simply php include it.

Make it look nice like this:

CODE
<h3>Recent Topics</h3>
        <p style="margin:0; padding: 0 5px 5px 2px; line-height: 18px;">
        <?php
            include("http://www.yoursite.com/forums/ssi.php?a=recent&amp;show=15");
        ?>
        &nbsp;<a href="/forums/index.php?act=Search&amp;CODE=getnew">New posts since last visit</a>    
        </p>

you can tweak the template to pass in more things. A lot of post info gets pulled in the php function.


it works, but notr like I want it to, you see, now I get this on my webpage:

Recent Topics
New posts since last visit


with a link to my board

I want the last 10 topics shown on my webpage, not a link to them. Is that possible?

Thanks for the help so far all of you smile.gif
briansol
yes, you need to alter the template recent.html to include exactly what you want.

the query pulls pretty much all the data you need. profile info, comments, etc etc.

simply replace the curly brackets. in my template file i use the view_all_link to get the href.


in the sql arrary, you can use the following:


'profile_link'
'member_name'
'post_date'
'topic_title'
'topic_title_hover'
'post'
'comments'
'view_all_link'


and anything else you want to select or join to with a custom sql query. just put them in that arrary.
snakerpg
QUOTE(briansol @ Apr 5 2006, 07:44 PM) *
yes, you need to alter the template recent.html to include exactly what you want.

the query pulls pretty much all the data you need. profile info, comments, etc etc.

simply replace the curly brackets. in my template file i use the view_all_link to get the href.
in the sql arrary, you can use the following:
'profile_link'
'member_name'
'post_date'
'topic_title'
'topic_title_hover'
'post'
'comments'
'view_all_link'


and anything else you want to select or join to with a custom sql query. just put them in that arrary.



could you please be more specific and detailed? I dunno much about code, I'm a real noob. Thanks
briansol
i dont have messenger access at work, sorry.


Basically, here's the deal.


The file i told you to make as your template:

CODE
&nbsp;<a href='{view_all_link}' title='{topic_title_hover}'>{topic_title}</a><br />


uses the key words from the array with the curly brackets.

so if you want the full info, you just need to mark up your template using those variables.

{post_date} gives you the post date.
{post} gives you the orig topic post.
{comments} gives you the number of replies.

and so on.


so if you want the full thing on your front page, you need to do something like this:


CODE
<table>
<tr>
<td><a href='{view_all_link}' title='{topic_title_hover}'>{topic_title}</a></td><td align="right">Posted:{post_date}</tr>
</tr>
<tr>
<td><a href='{profile_link}' title="View {member_name}'s Profile">{member_name}</a></td>
<td>{post}</td>
</tr>
<tr>
<td></td>
<td><a href='{view_all_link}'>View All Comments ({comments}) </a></td>
</tr>
</table>


that should get you started.
snakerpg
QUOTE(briansol @ Apr 6 2006, 11:21 AM) *
i dont have messenger access at work, sorry.
Basically, here's the deal.
The file i told you to make as your template:

CODE
&nbsp;<a href='{view_all_link}' title='{topic_title_hover}'>{topic_title}</a><br />


uses the key words from the array with the curly brackets.

so if you want the full info, you just need to mark up your template using those variables.

{post_date} gives you the post date.
{post} gives you the orig topic post.
{comments} gives you the number of replies.

and so on.
so if you want the full thing on your front page, you need to do something like this:
CODE
<table>
<tr>
<td><a href='{view_all_link}' title='{topic_title_hover}'>{topic_title}</a></td><td align="right">Posted:{post_date}</tr>
</tr>
<tr>
<td><a href='{profile_link}' title="View {member_name}'s Profile">{member_name}</a></td>
<td>{post}</td>
</tr>
<tr>
<td></td>
<td><a href='{view_all_link}'>View All Comments ({comments}) </a></td>
</tr>
</table>


that should get you started.


editing the template doesn't show anything new on my website, do i need to edit:

CODE
<h3>Recent Topics</h3>
        <p style="margin:0; padding: 0 5px 5px 2px; line-height: 18px;">
        <?php
            include("http://www.yoursite.com/forums/ssi.php?a=recent&amp;show=15");
        ?>
        &nbsp;<a href="/forums/index.php?act=Search&amp;CODE=getnew">New posts since last visit</a>    
        </p>


on my webpage too?

Thanks already for the help
briansol
all you NEED is the include:

CODE
<?php
            include("http://www.yoursite.com/forums/ssi.php?a=recent&amp;show=15");
        ?>


everything else is just to make it pretty. Since you're in a table on the template, you'll want to at least remove the <p> tags.

and of course, change yoursite to your actual domain.
snakerpg
QUOTE(briansol @ Apr 6 2006, 02:23 PM) *
all you NEED is the include:

CODE
<?php
            include("http://www.yoursite.com/forums/ssi.php?a=recent&amp;show=15");
        ?>


everything else is just to make it pretty. Since you're in a table on the template, you'll want to at least remove the <p> tags.

and of course, change yoursite to your actual domain.


I dun see anything now, I added this to index.htm (doe it have to be index.php?)

and now I see nothing instead of the text

my recent.htm template is located in forums/ssi_templates is that correct too?

Thanks
briansol
QUOTE(snakerpg @ Apr 6 2006, 03:23 PM) *
I dun see anything now, I added this to index.htm (doe it have to be index.php?)
Thanks


yes, home page will need to be .php


QUOTE(snakerpg @ Apr 6 2006, 03:23 PM) *
my recent.htm template is located in forums/ssi_templates is that correct too?


that is correct
snakerpg
QUOTE(briansol @ Apr 6 2006, 03:42 PM) *
yes, home page will need to be .php
that is correct


Ok I changed my index.htm to index.php

All I did was rename it, is that enough?

after doing tht and uploading, I get this as result:

Parse error: parse error, unexpected T_CASE, expecting '{' in /home/rpgexplo/public_html/forums/ssi.php on line 217

what am I suppose to do now? Sorry for being such a noob, you are really helping me, thanks.
briansol
looks like you typo'ed something or pasted into the wrong area on ssi.php. It's looking for that opening curly bracket.

the code i posted above is correct, as it was a direct copy off of my website which runs this code.

Make sure you wrapped the whole function in the { brackets } properly.
snakerpg
QUOTE(briansol @ Apr 7 2006, 12:06 PM) *
looks like you typo'ed something or pasted into the wrong area on ssi.php. It's looking for that opening curly bracket.

the code i posted above is correct, as it was a direct copy off of my website which runs this code.

Make sure you wrapped the whole function in the { brackets } properly.


you didn't let me edit my ssi.php ?

anyway the code is the original code:

CODE
/**
* Auto run class
*/
class ssi_autorun
{
    /**
    * Auto run function
    */
    function auto_run()
    case 'recent':                  
                $this->do_recent();
                break;
/**
    * Do Recent
    *
    * Shows recent posts
    */
    function do_recent()
    {


case 'recent': is line 217

I don't understand
Shmohel
Try this:

CODE
/**
* Auto run class
*/
class ssi_autorun
{
    /**
    * Auto run function
    */
    function auto_run(){
    case 'recent':                  
                $this->do_recent();
                break;
    }
/**
    * Do Recent
    *
    * Shows recent posts
    */
    function do_recent()
    {
snakerpg
QUOTE(Shmohel @ Apr 7 2006, 12:36 PM) *
Try this:

CODE
/**
* Auto run class
*/
class ssi_autorun
{
    /**
    * Auto run function
    */
    function auto_run(){
    case 'recent':                  
                $this->do_recent();
                break;
    }
/**
    * Do Recent
    *
    * Shows recent posts
    */
    function do_recent()
    {



changed, but now I get another error:

Parse error: parse error, unexpected T_CASE in /home/rpgexplo/public_html/forums/ssi.php on line 217
briansol
I think you put something in the wrong spot.

Start fresh with the ssi.php file from the Tools and Scripts download.

and re-add in the case 'recent' and the do_recent() function.

also, the template file must be recent.html, not recent.htm
snakerpg
QUOTE(briansol @ Apr 7 2006, 03:22 PM) *
I think you put something in the wrong spot.

Start fresh with the ssi.php file from the Tools and Scripts download.

and re-add in the case 'recent' and the do_recent() function.

also, the template file must be recent.html, not recent.htm


this still doesn't work.

Any way you could give me live support? through msn, icq, google talk? anyway?

Just let me know when, I'll reward you for your help. Thanks
briansol
As i stated before, I'm sorry, but I don't have access to messengers at work. They are all blocked.

do you have a link to your site that I can look at?
Kushal Pathak
Do you guys tried Subdreamer, everything can be pulled to your main webpage, and it's perfect integration with IPB. My all worries are gone and I am focussing on more on how to imporve my portal rather than coding wink.gif
Regards,
Poseidon_merged
QUOTE(Dr. kushal @ Apr 12 2006, 01:44 PM) *
Do you guys tried Subdreamer, everything can be pulled to your main webpage, and it's perfect integration with IPB. My all worries are gone and I am focussing on more on how to imporve my portal rather than coding wink.gif
Regards,

Subdreamer cost too much.. but it worth it.. biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.