Show your SMF Forums' Topic Replies on your own Websites 'index.html' page. ie partially at least Portalize your
own Website.
I make no pretentions of being anything more that enthusiastic when it comes to coding so please check
the code out first and know what your are running before you use it please. I'm open to ideas so please feel
free to make constructive suggestions.
The following PHP code canbe embedded into a suitable standard HTML page which canbe in turn called from
you websites main index.html page as follows:
<FONT COLOR=#004080><?
include 'http://www.menkaura.com/Place your subs folder name here/getReplies.php';
?></FONT>
Firstly use phpMyAdmin to setup a User/Password combination that has view rights over your SMF MySQL Database.
Amend the variables below to reflect you particular setup.
Have fun and if you need any assistance give please post against this top at http://www.menkaura.com/Forum/index.php?topic=334.0
If you want to see it working please have a look at http://www.menkaura.com
PS: Hopfully I've got the posts correct above.
<?
//Define and set variables.
$db_server = 'localhost';
$db_name = 'Your SMF MySQL DB Name Goes Here';
$db_user = 'An Appropriately Priv Users Name Goes Here';
$db_passwd = 'The Priv Users Password Goes Here';
//Connect to the server and select the databse ... with error checking.
$db_connection = @mysql_connect($db_server, $db_user, $db_passwd)
or die('Could not connect: ' . mysql_error());
mysql_select_db($db_name,$db_connection);
//Form the first query to get the fields from smf_messgaes table.
$get_most_replies = mysql_query("SELECT smf_messages.id_topic, smf_messages.subject, smf_topics.numReplies FROM smf_messages, smf_topics WHERE smf_messages.id_topic = smf_topics.id_topic AND smf_messages.subject NOT LIKE 'Re:%' ORDER BY numReplies Desc", $db_connection);
for($i = 1; $i < 9; $i++) {
$row = mysql_fetch_array($get_most_replies);
echo "$i. <a href='http://www.menkaura.com/Forum/?topic=$row[id_topic]'>$row[subject]<br />\n</a>";
} //end For...
//Finally clean up after yourself.
//Clear the memory used for the query result.
mysql_free_result($get_most_replies);
//Close the database connection.
mysql_close($db_connection);
?>
why not just use SSI.php?
To be honest I'm sure that there are other ways of doing the same thing. I was after an easy way to show Forum Topic posts and views on my Websites from page and independent of the SMF functionality.
However I'm certainly always after other ways of doing the same thing. If you could elabotrate a bit on ssi.php that would be great.
Many thanks ...
this is a built in function of smf. after including ssi.php into your page, inserting this single line would accomplish the same thing.
<?php ssi_recentTopics(); ?>
nice info, thanks, How can I put the info into tables? I want to use my site template tables.
thanks
Quote from: Tippmaster on December 22, 2005, 03:23:00 PM
this is a built in function of smf. after including ssi.php into your page, inserting this single line would accomplish the same thing.
<?php ssi_recentTopics(); ?>
I dont understand this... what do you mean "including ssi.php into your page"?? Id like to be able to do what menkaura has done on his page but if there is an easier like Tippmaster says I am all for that because I am vvery new to all this stuff.
Please read the SSI FAQs and look at ssi_examples.php.
ok I have looked at the ssi examples and thats what I want to do but I guess I am not doing something right. I also cant seem to locate the SSI FAQ.
Here's the link:
http://www.simplemachines.org/community/index.php?topic=14906.0
You'll have to explain what you've done so far and post the code you are using in order for me to help you.
I get the feeling I am doing it totally wrong hehe :-[
I just opened my index.html file and pasted this in it:
<?php
include('./bassin-forums/SSI.php?ssi_function=recentTopics');
?>
Well, I am more lost than ever now lol
Ive been reading the FAQ and the ssi_examples.php file
and now i have in my index.html file the very first line reading this:
<?php require("/home/harvester/public_html/forums/SSI.php"); ?>
so I think my next step would be to put this:
<?php ssi_recentTopics(); ?>
wherever I want on my index.html page? yes? Im thinking not or that I am missing something more because its not working still.
please help?
You can't use SSI inside of a static HTML page, it must be a php or shtml file. Just change index.html to index.php. If you don't have any experience coding PHP, I highly recommend visiting www.php.net and taking a look at the online documentation, and also searching the 'net for php tutorials. That will help you understand the basic workings of PHP.
I changed my page name to index.php and i see the recent topics now... only problem is... they are at the very top of the page behind my header graphic. I tried to move the code to the bottom of the page but the output is still at the very top of the page.
...and I thought I was lost and confused before?? lol