The anti-spam plugins have stopped being effective. Registration is back to requiring approval. After registering, you must ALSO email me with your username, so that I can manually approve your account.

Main Menu

Yet another newsbox problem

Started by crescens, July 03, 2007, 01:26:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Quote<?php function renderXepherNewsbox() {
//Newsbox config section, may be placed anywhere in the page above the newsbox

//All colors are quoted html-style colors, such as "#ffffff" for white, or "#000066" for dark blue
$border_color = "#b9a894" ;
$background_color = "#ffffff" ;
$text_color = "#718E86" ;
$button_background_color = "#ffffff" ;
$button_text_color = "#718E86" ;
$highlight_text_color = "#666666" ;
$title_text_color = "#000000" ;
$title_background_color = "#ffffff" ;
$link_text_color = "#718E86";

//Other Visual Options

$box_width = "200" ;
//Newsbox width measured in pixels. Values between 150 and 400

$border_width = "0" ;
// Border width measured in pixels, 0 for none

$align_box = "none" ;
//Which side to place the newsbox, with the rest of the page flowing around it. Can be "left", "right", or "none" to disable wrapping

//Display Config

$show_news = 0 ;
//Set to 0 to disable site news, 1 to show it. See "newsfile" option below

$news_file = "./news.txt" ;
//Text file to include for site news, note that the news "date" is set to the last modification date of this file.

$show_announcements = 0 ;
// Set to 0 for imporant only, 1 for normal

$show_feature = 1 ;
//Set to 0 for none, 1 for on

$show_nav_box = 1 ;
//Set to 0 for none, 1 for default list (auto-generated), 2 for custom list (see below)

$custom_nav_list = "xepher user otheruser" ;
//Space-seperated list of usernames to be linked in the nav-box. Add your favorite Phase 2 sites.

$show_hits = 1 ;
//Set to 0 for off, 1 for on

//End Config
include "/home/httpd/htdocs/newsbox.php";
} renderXepherNewsbox(); ?>


Alright, I just rewrote half the newsbox code to give safe variable names... but to keep compatibility with everyone who's already got it setup and working (aka everyone) you have to add an option.

First, add this line to the top of the config section.


Then preface all the existing config variables with "$XN_Newsbox_" e.g. "$box_width" becomes "$XN_Newsbox_box_width"

That should solve your problems, and let you forgo the function-wrapping Data's got you trying. As for the newsbox not validating... well, that's not just a search/replace sort of rewrite, but would require a fundamental design change in how the newsbox works. The reason/problem is that w3c doesn't allow CSS outside of the document head, but by the time the newsbox is included, head is already closed. The two options to fix that would involve having another code section people would have to place specifically in the head section of their pages, or I would have to rewrite the whole newsbox to use inline CSS. Obviously, the second option is preferable from a point of view of "correctness" and easiness, but is more work than I'm currently willing to put in for already obsolete code.

The new newsbox system will be completely different from the ground up, and while writing, I do intend to make sure it validates.


Sorry for the trouble, but that... didn't seem to make a difference. :(
Can I maybe leave the newsbox out until the new version is ready to be used?


Okay, so the problem has nothing to do with variable collisions. Quite simply, whatever that script/software your using is doing something rather stupid and probably dangerous too... None of the mysql query functions specify what database connection to actually use, so it just defaults to "the last one used." As the newsbox does SQL queries, your scripts start trying to lookup info in the XN user database after it's included, rather than your own database. That's not something that's going to be fixed by w3c valid css or other fix to the newsbox. The "SomeryC" scripts you're using are simply coded in a poor way, much like the newsbox variables were. I've rewritten that side of things, but you'll have to rewrite the other side to fix this.

The one other option is to make a separate page, with nothing but the newsbox on/in it, then include that as an iframe on your real page. If you do it right, with no scroll bars or anything, it'll look just the same. That's probably the easiest solution for now. The new newsbox is several months off at least, and I'm still not decided on exactly how it'll function, or what resources it'll use. That is to say, I don't know if it'll have this same problem or not. I don't THINK it will, but we'll see once I get more ideas solidified for it.


Alright, I'll do that.
I really don't think I can rewrite the script if I tried, but I'll report the problem on their forum and see how they respond.  Thanks for everything.