We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20289
    • 958 Posts
    Consider SMFand MODx versioning differences, get their changelog and see what have been changed since the particular working release of this item.
      [img]http://i10.tinypic.com/52c4eir.gif[/img][/td]
      [td][Wiki] [Persian support forum]
      [SVN] [RTL SVN Branch] [bugs] [FishEye+Crucible] [Learn MODx!] | [My Google Code]
      [font=tahoma][برای دسترسی به راهنمای فارسی به [url=http://www.modxcms.ir]
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      Hello,

      I just installed SMFssi to use the ssi_boardNews fuction, but I can’t figure out how to chose the board or control the output.

      I found this code on the SMF Forums and it appears to be just what I need, but I can’t figure out how to convert it to MODx format...

      The SMFpost is here: http://www.simplemachines.org/community/index.php?topic=13016.msg111612#msg111612

      Also I am guessing that instead of the 5 in use below I would use 2 as the address is domain.com/index.php?board=2.0

      Any help is welcome
      AMDbuilder

      Oh, I didn’t use the board fix and everything worked fine except it used the wrong forum and I want to better control the output..

      	$array = ssi_boardNews(5, null, null, null, 'array');
      
      	foreach ($array as $news)
      	{
      		echo '
      			<table border="0" width="100%" align="center" class="ssi_table">
      				<tr>
      					<td><b>', $news['subject'], '</b></td>
      				</tr>
      				<tr>
      					<td>', $news['body'], '<br /><br /></td>
      				</tr>
      			</table>
      			<br />';
      
      		if (!$news['is_last'])
      			echo '
      			<hr width="100%" />
      			<br />';
      	}
      
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 1343 ☆ A M B ☆
        • 2,213 Posts
        Anyone have any suggestions on how to accomplish the above with MODx? Or is this something I can only do with a non cms site?

        AMDbuilder
          Patrick | Server Wrangler
          About Me: Website | Tweets |  MODX Hosting
          • 25551 ☆ A M B ☆
          • 1,231 Posts
          I know this is an old topic but I was wondering if anyone has managed to have the SMF ssi_welcome parameter work on their site? I can get it to show up but if I sign in and return to the modx site it says login again.
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 33982 ☆ A M B ☆
            • 476 Posts
            I just installed SMFssi to use the ssi_boardNews fuction, but I can’t figure out how to chose the board or control the output.
            I actually have a site I’m designing that will need this same thing.  I’ve gotten a test SMF forum (just using it to experiment with these snippets) setup (http://my619.com/smf) and have been playing around with the SSI snippet (see it here: http://my619.com/index.php?id=154) ... but I want to be able to feed certain categories onto certain pages of the site.  For example if I have a nutrition category, I would like to be able to grab the last 5 topics from the "Nutrition" category and post those last 5 topics from the "Nutrition" category from the Forum onto my "Nutrition" category page of my website, not the last 5 topics from the entire forum.  I saw that you started this question earlier AMDbuilder, but it doesn’t look like there was any resolution...were you able to figure it out?

            Any insight would be greatly appreciated!
              Precision Web Development ... SmashStack.com
              • 1343 ☆ A M B ☆
              • 2,213 Posts
              Hello,

              My solution to the problem was actually to just modify the SSI.php file and be done with it. Granted this isn’t the brightest idea so I started to think about other options (very recently) and came up with this, granted it’s both unfinished and untested...

              Someone with a little free time and php skills will need to finish it, but this should give you a decent starting point if you need a simple method of pulling posts from SMF for use as a website news system. I don’t need it any longer so I have no need/desire to finish the code, but whoever needs it have at it.

              Enjoy
              AMDbuilder


              
              SQL Query to get Post Body from News Topic Database.
              
              
              SELECT `subject`, `body` FROM {$table} WHERE `ID_BOARD` ='5' ORDER BY `posterTime` DESC
              
              ____
              
              What To Do
              
              1. Connect to DB - Check
              2. Connect to Table - Check
              3. Verify connections or error out - Check
              4. Query Post Results - Check
              5. Query Post Titles
              6. Combine Output
              7. Create Final Output for Display
              ____
              
              <?php
              $db_host = 'localhost';  //This is the default in most cases
              $db_user = 'USER';
              $db_pwd = 'PASS';
              
              $database = 'FORUM-DATABASE';  //This needs to be your SMF Database
              $table = 'smf_messages'; //This should work by default unless you changed your table prefex if so modify accordingly
              
              if (!mysql_connect($db_host, $db_user, $db_pwd))
                  die("Can't connect to database");
              
              if (!mysql_select_db($database))
                  die("Can't select database");
              
              // sending query
              $subject = mysql_query("SELECT `subject` FROM {$table} WHERE `ID_BOARD` ='5' ORDER BY `posterTime` DESC");
              if (!$subject) {
                  die("Failed to get Subject");
              }
              $body = mysql_query("SELECT `body` FROM {$table} WHERE `ID_BOARD` ='5' ORDER BY `posterTime` DESC");
              if (!$body) {
                  die("Failed to get Body");
              }
              
              $sub = mysql_num_fields($subject);
              $bod = mysql_num_fields($body);
              
              // printing table rows
              while($row = mysql_fetch_row($result))
              {
                  echo "<tr>";
              
                  // $row is array... foreach( .. ) puts every element
                  // of $row to $cell variable
                  foreach($row as $cell)
                      echo "
              		<p>
              		$cell
              		</p>
              		<hr class='divider' />";
              
                  echo "</tr>\n";
              }
              mysql_free_result($result);
              ?>
              
              //////////   Current SSI Customization - Target Formating  //////////
              
              	<h1><img src='images/ill_title.jpg' alt='ill title' width='63' height='20' />', $news['subject'], '</h1>
              	<p>', $news['body'], '</p>
              	<hr class="divider" />
              
                Patrick | Server Wrangler
                About Me: Website | Tweets |  MODX Hosting
                • 16194
                • 103 Posts
                Quote from: Soda at May 07, 2007, 12:37 PM

                To pass parameters to the function:
                change the line in the snippet SMFssi:
                return $ssi(); with return $ssi($param) ;
                To know the parameters, see the smf SSI.php file, for recentTopics:
                function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = ’echo’)

                so to display 3 recent topics the call is:
                [[SMFssi? &ssi=`ssi_recentTopicss` &param=`3`]]


                Ok, this IS an old topic, hope anyone can help anyways...

                As soon as I ad the $param to the return $ssi() in the snippet, the following happens.
                When I try to access my homepage, which calls the login function (regardless if with or without an $param),
                it doesn’t get loaded, instead I get a SMF Page with a database error.

                What I try to achieve is a redirect when you login from the homepage, because it will always lead you to the forums.

                Any ideas what’s wrong here??

                Thanx!
                  Impossible is nothing - with ModX
                  • 16194
                  • 103 Posts
                  No ideas? sad
                    Impossible is nothing - with ModX
                    • 29319
                    • 37 Posts
                    Hi im a newbie to modx don’t really understand snippets. Could someone show me what the snippet code would be to call recent topics?
                      • 16194
                      • 103 Posts
                      This should work...

                      [[SMFssi? &ssi=ssi_recentTopics]]
                        Impossible is nothing - with ModX