SMF Support > SMF 2.0.x Support
Using SSS.PHP
bestfriendavinash:
I was going through following tutorial
--- Code: ---http://www.simplemachines.org/community/ssi_examples.php
--- End code ---
and tried to learn the sample website, the code is as below:
--- Code: ---<?php require("SSI.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>SSI.php example for home page</title> <style type="text/css"> body { font-family: Arial, Tahoma, sans-serif; font-size: 80%; background: #DFDFDF; color: #FFFFFF; margin: 0 } ul,ol { padding-left: 19px; margin: 0; } li { font-size: 11px; } h1,h2,h3 { margin: 0; padding: 0; } h3 { font-size: 15px; } a:link,a:visited { color: #FF9000; text-decoration: none; } a:hover { text-decoration: underline; } #container { background: #52514E; width: 100%; border: 1px solid midnightblue; line-height: 150%; margin: 0; } #header,#footer { color: lightgray; background-color: #2A2825; clear: both; padding: .5em; } #leftbar { background: #DF7E00; float: left; width: 160px; margin: 0; padding: 1em; } #leftbar a { color: #000000; text-decoration: underline; } #content { margin-left: 190px; padding: 1em; } #navigation { float: right; } #navigation a:link,#navigation a:visited { color: #FF9000; } </style> </head> <body> <div id="container"> <div id="header"> <div id="navigation"> <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> </div> <h1 class="header">YourWebsite.com</h1> </div> <div id="leftbar">
<h3>Recent Forum Topics</h3> <ul> <?php // Using array method to show shorter display style. $topics = ssi_recentTopics(8, null, null, 'array'); foreach ($topics as $topic) { // Uncomment the following code to get a listing of array elements that SMF provides for this function. // echo '<pre>', print_r($topic), '</pre>'; echo ' <li><a href=\"', $topic['href'], '\">', $topic['subject'], '</a> ', $txt['by'], ' ', $topics[$i]['poster']['link'], '</li>'; } unset($topics); ?> </ul><br />
<h3>Online Users</h3> <?php ssi_logOnline(); ?> </div> <div id="content"> <?php ssi_welcome(); ?><br /><br /> <h2>News</h2> <?php ssi_boardNews(); ?> </div> <div id="footer"> <a target="_blank" rel="license" href="http://creativecommons.org/licenses/publicdomain/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/publicdomain/88x31.png" /></a> This sample website layout is dedicated to the <a target="_blank" rel="license" href="http://creativecommons.org/licenses/publicdomain/">Public Domain</a>. </div> </div> </body> </html>
--- End code ---
It worked perfectly for me except the recent topic ... where nothing was displaying... so I found that "Uncomment the following code to get a listing of array elements that SMF provides for this function. ".. so I tried following code for recent topic
--- Code: ---<h3>Recent Forum Topics</h3> <ul> <?php $topics = ssi_recentTopics(8, null, null, 'array'); foreach ($topics as $topic) { echo '<pre>', print_r($topic), '</pre>'; echo ' <li><a href=\"', $topic['href'], '\">', $topic['subject'], '</a> ', $txt['by'], ' ', $topics[$i]['poster']['link'], '</li>'; } unset($topics); ?> </ul><br />
--- End code ---
but the result was a complete mess up...
can anyone tell me where I am doing it wrong... I'll prefer to go with above code only as it will fit in the space available on my page.
Thanks in advance
Luis-:
I've tried your code and you could always used
--- Code: ---<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>
--- End code ---
which does what your code does but the code is easier to read and works like it should.
bestfriendavinash:
--- Quote from: Luis- on April 22, 2012, 11:00:37 AM ---I've tried your code and you could always used
--- Code: ---<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>
--- End code ---
which does what your code does but the code is easier to read and works like it should.
--- End quote ---
but the result of this code is not suitable for me... I want result as in sample website1 on
--- Code: ---http://www.simplemachines.org/community/ssi_examples.php
--- End code ---
page
Luis-:
Hmm, i'm confused with this as much as you are. I'll keep trying it though. I've gotten it to work a little though, http://forum.sa-a.co.cc/test.php.
Yoshi:
Luis: Make sure you include it at the top of your script, as it says :)
Navigation
[0] Message Index
[#] Next page
Go to full version