Hi everyone!

I am trying to get some of my forum data on my web sites home page but having trouble.

I want to run this script from my web site but this little statement is confusing me: $phpbb_root_path = '../../../'; I need to point this to my forum (I think) I have tried so many combinations now I give up :glare:

Along with fixing the above to point to the right location I am thinking I can just paste this in my home page and it should work right? according to the mod I have made the "mods" folder and put all associated files there.

<?php
$phpbb_root_path = '../../../';
define ('IN_PHPBB', true);
include_once ($phpbb_root_path . 'extension.inc'); // always need on all scrips
include_once ($phpbb_root_path . 'common.' . $phpEx); // always need on all scrips
include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx); // always need on all scrips
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx); // commons is shared code
include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx); // this one depends on your goal
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$news = phpbb_fetch_posts();
phpbb_disconnect();
?>
<ul>
<?php for ($i = 0; $i < count($news); $i++) { ?>
<li><?php echo $news[$i]['topic_title']; ?></li>
<?php } ?>
</ul>

Thanks!!

    When posting PHP code, please use the board's [PHP][/PHP] bbcode tags - they make the code much, much easier to read (as well as aiding the diagnosis of syntax errors). You should edit your post now and add these bbcode tags to help others in reading/analyzing your code.

      bradgrafelman wrote:

      When posting PHP code, please use the board's [PHP][/PHP] bbcode tags - they make the code much, much easier to read (as well as aiding the diagnosis of syntax errors). You should edit your post now and add these bbcode tags to help others in reading/analyzing your code.

      Oh wow, that is much better!

      I think I have solved my problem, I did not know I had to end my index page in .php instead of .html

        Don't forget to mark this thread resolved (if it is).

          Write a Reply...