Current time: 01-08-2009, 11:02 PM Hello There, Guest! (LoginRegister)


Post Reply 
Removing Postbit from Announcements
08-18-2008, 09:09 PM (This post was last modified: 08-18-2008 09:11 PM by Kodaks.)
Post: #1
Removing Postbit from Announcements
Hello,
I've been developing a new plugin for MyBB 1.4 and I seem to have hit a roadblock.

I wanted to remove all styling and header/footer items from the announcements.php pages on the forum. I opened up the announcement template and found this:

Code:
<html>
<head>
<title>{$lang->announcements}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both; border-bottom-width: 0;">
<tr>
<td class="thead" colspan="3"><strong>{$lang->forum_announcement}</strong></td>
</tr>
</table>
{$announcement}
{$footer}
</body>
</html>

So, I simply replaced it with this:
Code:
{$announcement}

I was dismayed to see that even after I altered the template, the announcements still had postbit_classic styles attached to them:

   

I only want the announcement message to display when someone visits an announcements.php page. I do not want the postbit buttons, border, background or tables to be used.

I looked around announcements.php and /inc/functions_post.php, but could not find anything myself.

How do I remove the postbit layout from the annoucements?

I'm sure I have overlooked something simple, but for the life of me I just can't figure it out.

Thanks for any help, I greatly appreciate it!

[Image: button16.png] - My Host of Choice for 2 Years
Coupon Codes:
KodaksFive - $5 Off Your Order
KodaksFifteen - 15% Off Your Order
Visit this user's website Find all posts by this user
Quote this message in a reply
08-19-2008, 07:22 AM
Post: #2
RE: Removing Postbit from Announcements
If you're developing a plugin, the simplest thing would probably to write your own announcements.php page, since all you want is the message.

Something like this I suppose:
PHP Code:
define('IN_MYBB'1);
require 
'./global.php';
require_once 
MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;

$aid intval($mybb->input['aid']);
$ann $db->fetch_array($db->simple_simple('announcements''*''aid='.$aid));
if(!
$ann)
error('Invalid announcement'); // use the correct langvar here if you wish

// set the parser options here appropriately
$options = array();
$message $parser->parse_message($ann['message'], $options);

echo 
$message

Who is Yumi?


It's still the KFC crazed person who can't spell names properly with annoying AlTeRnAtInG CaPiTaLs in the NaMe
Visit this user's website Find all posts by this user
Quote this message in a reply
08-19-2008, 02:22 PM (This post was last modified: 08-20-2008 06:50 PM by Kodaks.)
Post: #3
RE: Removing Postbit from Announcements
(08-19-2008 07:22 AM)ZiNgA BuRgA Wrote:  If you're developing a plugin, the simplest thing would probably to write your own announcements.php page, since all you want is the message.

Something like this I suppose:
PHP Code:
define('IN_MYBB'1);
require 
'./global.php';
require_once 
MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;

$aid intval($mybb->input['aid']);
$ann $db->fetch_array($db->simple_simple('announcements''*''aid='.$aid));
if(!
$ann)
error('Invalid announcement'); // use the correct langvar here if you wish

// set the parser options here appropriately
$options = array();
$message $parser->parse_message($ann['message'], $options);

echo 
$message

Thanks, I'll try this out.

[Image: button16.png] - My Host of Choice for 2 Years
Coupon Codes:
KodaksFive - $5 Off Your Order
KodaksFifteen - 15% Off Your Order
Visit this user's website Find all posts by this user
Quote this message in a reply
08-20-2008, 06:49 PM (This post was last modified: 08-20-2008 06:49 PM by Kodaks.)
Post: #4
RE: Removing Postbit from Announcements
Hmm...I seem to be having a bit more problems with the new announcement page you suggest I create.

I created a new "announcements" page that is called information.php. Inside, I have the following PHP code:
PHP Code:
<?php
phpdefine
('IN_MYBB'1);
require 
'./global.php';
require_once 
MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;

$aid intval($mybb->input['aid']);
$ann $db->fetch_array($db->simple_simple('announcements''*''aid='.$aid));
if(!
$ann)
error('Invalid announcement'); // use the correct langvar here if you wish

// set the parser options here appropriately
$options = array();
$message $parser->parse_message($ann['message'], $options);

echo 
$message;
?>

When I visit the information.php?aid=9 page in my browser, I get the following error:
Quote:Fatal error: Call to undefined function: simple_simple() in */*/public_html/information.php on line 8

Line 8 of the information.php is:
PHP Code:
$ann $db->fetch_array($db->simple_simple('announcements''*''aid='.$aid)); 

I don't understand the simple_simply part of code on this line. Is this a new development in MyBB, or is it a coding mistake?

What do I need to do in order to get this new information.php page to function correctly?

Thanks again for your help, I really appreciate it!

[Image: button16.png] - My Host of Choice for 2 Years
Coupon Codes:
KodaksFive - $5 Off Your Order
KodaksFifteen - 15% Off Your Order
Visit this user's website Find all posts by this user
Quote this message in a reply
08-20-2008, 09:17 PM
Post: #5
RE: Removing Postbit from Announcements
(08-20-2008 06:49 PM)Kodaks Wrote:  I don't understand the simple_simply part of code on this line. Is this a new development in MyBB, or is it a coding mistake?

It's just a typo, it should be simple_select. Toungue
Visit this user's website Find all posts by this user
Quote this message in a reply
08-20-2008, 09:21 PM
Post: #6
RE: Removing Postbit from Announcements
Shouldn't simple_simple be simple_select?

MYPS is now available for FREE!
Download over 30 exclusive plugins at Mybb Central.
[Image: mybbsig.php]
[Some plugins at Mybb Central are for paid subscribers only.]
Visit this user's website Find all posts by this user
Quote this message in a reply
08-21-2008, 05:23 AM
Post: #7
RE: Removing Postbit from Announcements
(08-20-2008 09:17 PM)WDZ Wrote:  
(08-20-2008 06:49 PM)Kodaks Wrote:  I don't understand the simple_simply part of code on this line. Is this a new development in MyBB, or is it a coding mistake?

It's just a typo, it should be simple_select. Toungue

(08-20-2008 09:21 PM)labrocca Wrote:  Shouldn't simple_simple be simple_select?
I understand it was a typo, but didn't used to have something else included in those kinds of lines for this type of function to work? Was there some kind of change with this new version?

[Image: button16.png] - My Host of Choice for 2 Years
Coupon Codes:
KodaksFive - $5 Off Your Order
KodaksFifteen - 15% Off Your Order
Visit this user's website Find all posts by this user
Quote this message in a reply
08-21-2008, 06:25 AM
Post: #8
RE: Removing Postbit from Announcements
You could store the query result resource in a temporary variable like this, but ZiNgA BuRgA made his code a bit more compact.

PHP Code:
$query $db->simple_select('announcements''*''aid='.$aid);
$ann $db->fetch_array($query); 

The only change I can think of in 1.4 is that you don't need to use TABLE_PREFIX anymore.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-21-2008, 07:06 PM
Post: #9
RE: Removing Postbit from Announcements
Quote:The only change I can think of in 1.4 is that you don't need to use TABLE_PREFIX anymore.

Ahhh...thats what I was thinking of! Smile

After I changed the simple_simple to simple_select, but now I am experiencing a different error message. Here is the error:

Quote:Fatal error: Call to undefined function: phpdefine() in */*/public_html/information.php on line 2

Again, here is the code I am using for information.php:
PHP Code:
<?php
phpdefine
('IN_MYBB'1);
require 
'./global.php';
require_once 
MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;

$aid intval($mybb->input['aid']);
$ann $db->fetch_array($db->simple_select('announcements''*''aid='.$aid));
if(!
$ann)
error('Invalid announcement'); // use the correct langvar here if you wish

// set the parser options here appropriately
$options = array();
$message $parser->parse_message($ann['message'], $options);

echo 
$message;
?>

It seems to me that I am missing the code where it instructs the script to retrieve the applicable announcements from the MySQL database. I tried adding that part it, but to no avail. Any ideas?

Thanks again!

[Image: button16.png] - My Host of Choice for 2 Years
Coupon Codes:
KodaksFive - $5 Off Your Order
KodaksFifteen - 15% Off Your Order
Visit this user's website Find all posts by this user
Quote this message in a reply
08-21-2008, 09:46 PM
Post: #10
RE: Removing Postbit from Announcements
http://php.net/define

There's no phpdefine Toungue

[Image: sig.php?mybb]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: