Topic: html head now showing in my plugin page... weird
I as very calmly writing my plugin when, at some point, i refreshed the page and suddenly the html head was gone and the page displayed the contend without any styling.
I tried to find out if i accidentally deleted a line of code or something but aparently everything looks normal in my code...
here's what i wrote so far, please let me know if you found the error.
<?php
/***********************************************************************
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
This file is part of PunBB.
PunBB is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PunBB is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
************************************************************************/
##
##
## A few notes of interest for aspiring plugin authors:
##
## 1. If you want to display a message via the message() function, you
## must do so before calling generate_admin_menu($plugin).
##
## 2. Plugins are loaded by admin_loader.php and must not be
## terminated (e.g. by calling exit()). After the plugin script has
## finished, the loader script displays the footer, so don't worry
## about that. Please note that terminating a plugin by calling
## message() or redirect() is fine though.
##
## 3. The action attribute of any and all <form> tags and the target
## URL for the redirect() function must be set to the value of
## $_SERVER['REQUEST_URI']. This URL can however be extended to
## include extra variables (like the addition of &foo=bar in
## the form of this example plugin).
##
## 4. If your plugin is for administrators only, the filename must
## have the prefix "AP_". If it is for both administrators and
## moderators, use the prefix "AMP_". This example plugin has the
## prefix "AMP_" and is therefore available for both admins and
## moderators in the navigation menu.
##
## 5. Use _ instead of spaces in the file name.
##
## 6. Since plugin scripts are included from the PunBB script
## admin_loader.php, you have access to all PunBB functions and
## global variables (e.g. $db, $pun_config, $pun_user etc).
##
## 7. Do your best to keep the look and feel of your plugins' user
## interface similar to the rest of the admin scripts. Feel free to
## borrow markup and code from the admin scripts to use in your
## plugins. If you create your own styles they need to be added to
## the "base_admin" style sheet.
##
## 8. Plugins must be released under the GNU General Public License or
## a GPL compatible license. Copy the GPL preamble at the top of
## this file into your plugin script and alter the copyright notice
## to refrect the author of the plugin (i.e. you).
##
##
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
exit;
// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
$filestring = file_get_contents("plugins/topiclists.txt");
$ids_forum_post = unserialize($filestring);
if (empty($ids_forum_post)){
$query = "SELECT ".$db->prefix."forums.id, ".$db->prefix."forums.forum_name, ".$db->prefix."topics.subject, ".$db->prefix."posts.id FROM ".$db->prefix."forums, ".$db->prefix."topics, ".$db->prefix."posts WHERE ".$db->prefix."posts.id=$postid AND ".$db->prefix."forums.id=$forumid AND ".$db->prefix."posts.topic_id=".$db->prefix."topics.id";
$result = $db->query($query);
$list = $db->fetch_assoc($result);
}
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div id="exampleplugin" class="blockform">
<h2><span>Topic list plugin</span></h2>
<div class="box">
<div class="inbox">
<p>This plugin allows you to create topiclists by defining the forum you want to create a list of and the topic where the list should go. The topic must exist already. </p><p>PLEASE NOTE:All cotent in the topic will replaced by the new topiclist.</p>
<p>
<?php
dump($list,$ids_forum_post);
echo $query;
?>
</p>
</div>
</div>
<h2 class="block2"><span>Topic Lists</span></h2>
<div class="box">
<fieldset>
<legend>Current topic lists</legend>
<div class="infldset">
<table class="aligntop" cellspacing="0">
<tr>
<th scope="row">Forum</th>
<th scope="row">Topic</th>
</tr>
</table>
</div>
</fieldset>
<form id="example" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>&foo=bar">
<div class="inform">
<fieldset>
<legend>Create a new Topiclist</legend>
<div class="infldset">
<table class="aligntop" cellspacing="0">
<tr>
<th scope="row">Forum ID:</th>
<td>
<input type="text" name="forum_id_tolist" size="10" tabindex="1" />
</td>
</tr>
<tr>
<th scope="row">Post ID:</th>
<td>
<input type="text" name="post_id_tolist" size="10" tabindex="2" />
</td>
</tr>
<tr>
<th scope="row"><input type="submit" name="newlist" value="create" tabindex="3" /></th>
</tr>
</table>
</div>
</fieldset>
</div>
</form>
</div>
</div>
<?php
// Note that the script just ends here. The footer will be included by admin_loader.php.
The query is not fetching anything yet, i got interrupted when i was fetching values to put into it.