MyBB Community Forums

Full Version: Site news Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I followed the instructions in the read me, but I get this on the page where I want the recent posts displayed
run_hooks("site_news_plugin_run"); ?>
Add a <? in front of it.
labrocca Wrote:Add a <? in front of it.
I'm still getting the same problem. Here's the code of the page
<!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">
<?php
define(IN_MYBB, 1);
$rel = "forums/"; // The directory to your forum--relative to this file's location; include ending slash
require $rel."global.php";
?>
<head>
<script>
function submitted()
{
 setTimeout("refresh()",6000);
}
function refresh()
{
 var sURL = unescape(window.location.pathname);
 window.location.href = sURL;
}
</script> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Crazy Computers</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--header start -->
<div id="header">
<ul>
<li><a href="http://www.crazycomputers.org/index.html" class="hover">Home</a></li>

<li><a href="http://www.crazycomputers.org/forums/index.php">Forums</a></li>
<li><a href="http://www.crazycomputers.org/videos.html">Videos</a></li>
</ul>
<a href="index.html"><img src="images/logo.gif" alt="jet 30" width="249" height="72" border="0" class="logo" /></a>

<img src="images/top_icon.gif" alt="jet 30 says" width="174" height="80" class="icon" />
<p class="topText">Registration in the forums is <span class="txt1">completely free</span> and takes only a minute of your time.</p>
<a href="http://www.crazycomputers.org/forums/member.php?action=register" class="readMore"></a>
</div>
<!--header end -->
<!--body start -->

<div id="body">
<!--left panel start -->
<div id="left">
<!--left1 start -->
<div id="left1">
<img src="http://www.crazycomputers.org/systems/seanssystem.bmp" alt="Seans system Pic">
<p class="boxTxt1"><span>Seans's System</span><b>Specifications: </b>Intel Core 2 Duo E6600, Asus P5B Deluxe, Crucial Ballistix Tracer 2x1GB DDR2 1000, Lian-Li PC v2000 Plus II, Swiftech H20-120 Watercooling, Western Digital Raptor 74GB, EVGA 8800GTS 512MB</p>
<br class="spacer" />
</div>
<!--left1 end -->
<!--left2 start -->
<div id="left2">
<p class="pic2"></p>
<p class="boxTxt2"><span>System #2</span><b>Specifications: </b>Your system could be here! For your chance to be featured register in the forums.</p>

<br class="spacer" />
</div>
<!--left2 end -->
<!--left3 start -->
<div id="left3">
<p class="pic3"></p>
<p class="boxTxt3"><span>System #3</span><b>Specifications: </b> Your system could be here!</p>
<!--left3 end -->
<br class="spacer" />
</div>
<!--left2 end -->
<br class="spacer" />
</div>

<!--left panel end -->
<!--right panel start -->
<div id="right">
<p class="rightTop"></p>
<h2>Welcome to Crazy Computers</h2>
<p class="rightTxt1">Crazy Computers is a community for computer enthusiasts to talk about computers and admire the work others have done on their systems.</p>
<p class="rightTxt2">Each week three new system are selected to be featured on the homepage. For your system to be eligible you must be registered and must post your system <a href="http://www.crazycomputers.org/forums/showthread.php?tid=5">here</a> in the forums.</p>
<p class="rightPic"></p>
<p class="rightBottom"></p>
<br class="spacer" />
</div>

<!--right panel end -->
<br class="spacer" />
</div>
<!--body end -->
<!--bodyBottom start -->
<div id="bodyBottom">
<!--news start -->
<div id="news">
<h2>Recent Posts</h2>
<h3>new forum posts</h3>
<?php

define("IN_MYBB", 1);
define("KILL_GLOBALS", 1);
define("NO_ONLINE", 1);

$directory_to_forum = "http://www.crazycomputers.org"; 

require dirname(__FILE__)."/".$directory_to_forum."/global.php";

<?$plugins->run_hooks("site_news_plugin_run");

?>
</div>
<!--news end -->
<!--services start -->
<div id="service">

<h2>Useful Links</h2>
<h3>Look here for useful links</h3>
<ul>
<li><a href="http://www.nvidia.com/Download/index.aspx?lang=en-us">Nvidia Drivers</a></li>
<li><a href="http://www.newegg.com/">NewEgg</a></li>
<li><a href="http://www.tigerdirect.com/">TigerDirect</a></li>
<li><a href="http://www.google.com/">Google</a></li>
</ul>
<br class="spacer" />
</div>
<!--services end -->

<!--member start -->
<!--member end -->
<div id="member">
  <h2>Member Login</h2>
  <form action="#" method="post" name="member_log_in" id="member_log_in">
    <label>Username:</label>
    <input type="text" name="name" class="txtBox" />
    <label>Password:</label>
    <input type="password" name="name2" class="txtBox" />

	<a href="http://www.crazycomputers.org/forums/member.php?action=register">Sign up here!</a>
	<input type="submit" name="go" value="" class="go" />
    <br class="spacer" />
  </form>
  <br class="spacer" />
</div>
<br class="spacer" />
</div>
<!--bodyBottom end -->
<!--footer start -->
<div id="footer">

<ul>
	<li><a href="http://www.crazycomputers.org/index.html">Home</a>|</li>
	<li><a href="http://www.crazycomputers.org/forums/index.php">Forums</a>|</li>
	<li><a href="http://www.crazycomputers.org/videos.html">Videos</a></li>
	
  </ul>
   <p class="copyright">&copy; Jet 30. All rights reserved.</p>

	<p class="design">Designed By : <a href="http://www.templateworld.com">Template World</a></p></div>
<!--footer end -->
</body>
</html>
<?$plugins->run_hooks("site_news_plugin_run");

Change that to:

$plugins->run_hooks("site_news_plugin_run");
I just looked at your site and looking at the code above you need to save the page as index.php not index.html.

Any page that contains php scripts <?php ?> tags needs to be saved as a php file not a html file.

Cheers Fishntassie...
labrocca Wrote:<?$plugins->run_hooks("site_news_plugin_run");

Change that to:

$plugins->run_hooks("site_news_plugin_run");

fishntassie Wrote:I just looked at your site and looking at the code above you need to save the page as index.php not index.html.

Any page that contains php scripts <?php ?> tags needs to be saved as a php file not a html file.

Cheers Fishntassie...
I tried both of these things, but it still doesn't work. I also tried changing it to index.php, and it still didn't work, and also when I uploaded it to my server it gave me an error:
Fatal error: main() [function.require]: Failed opening required './inc/init.php' (include_path='.:/usr/lib/php') in /homepages/19/d230750232/htdocs/forums/global.php on line 13
OK hascet i think i can see your problems

the code for the plugin script is wrong and should read as shown below

			    <?php

define("IN_MYBB", 1);
define("KILL_GLOBALS", 1);
define("NO_ONLINE", 1);

// The Directory to the forum you are using this on. 
// You do not need a beggining or trailing slash
$directory_to_forum = "forums"; 

require dirname(__FILE__)."/".$directory_to_forum."/global.php";

$plugins->run_hooks("site_news_plugin_run");

?>

remember to save the file as index.php for the server to run your scripts.

Cheers Fishntassie...