News:

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 2 Guests are viewing this topic.

crescens

Sorry for being a bother again.
I was trying to incorporate the newsbox into my page, but for some reason, whenever I include it, the rest of my script breaks. :/
It works perfectly without the newsbox, and I'm just not sure where the problem is, because there are parts of the script that includes other pages, and it works fine.
Here's the page: http://crescens.xepher.net/fish/index.php

Any help would be appreciated, thanks.


Databits

#1
I wonder... is the news box included PHP? If so, did you make sure that you aren't duplicating any variables that it sets or uses?

Also, I'm noticing a javascript function call in the body onload handler called "goforit()", but the javascript function isn't defined anywhere.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

I'm... actually not sure what that does either.
Well, I got rid of it, and it didn't make a difference. :/

Databits

#3
Also note that:
<a class=newsbox href=# onClick="top.location.href = document.siteselector.sitelist.options[document.siteselector.sitelist.selectedIndex].value;">Go</a>
is incorrect (X)HTML...

Instead it should be this (you are missing the quotes):
<a class="newsbox" href="#" onClick="top.location.href = document.siteselector.sitelist.options[document.siteselector.sitelist.selectedIndex].value;">Go</a>

Also, could you copy the index.php to something like index2.php and remove the newsbox so I can see a working copy of the script?
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

I... honestly don't even know where that line is, so I don't know how to fix it. D:

Here is the working script: http://crescens.xepher.net/fish/index2.php

All I did was remove this:
Quote<?php include "/home/httpd/htdocs/newsbox.php" ?>

Databits

#5
Ok, I'm willing to bet that somewhere in there is a variable conflict of some sort... strange that it's not spitting a PHP error to the screen or anything though.

Yeah... after doing a dump on that particular script it looks like it'd be quite easy for another program to use some of the things that it writes. So I'm gonna write you a quick thing to try out... gimme a sec.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

Databits

#6
Hmm my account here seems to have been locked, sorry can't help atm but try this anyhow:

<?php function renderXepherNewsbox() { include "/home/httpd/htdocs/newsbox.php"; } renderXepherNewsbox(); ?>

Now to explain what this is doing. Since you're including the script on a global level, it's (re)defining the variables in that script on a global level. What I did was wrapped it in a function, which should make the variables exclusive to that function alone, keeping the global values safe.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

Oh, it works!! :D :D
But... now all the visual configuration is gone.  Is there any way to incorporate those, or am I asking or too much?

Databits

Add them into the function call at the top:

<?php
function renderXepherNewsbox() {
  
// Place your configuration constants here...

  
include "/home/httpd/htdocs/newsbox.php";
}
renderXepherNewsbox();
?>
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

Xepher

Hmm, I'll have to be more careful with code when I rewrite the newsbox. Glad ya'll got it figured out though.

griever

I don't mean to sound naggy, Xepher, but with the new newsbox, could you also have HTML that validates?  I ran mine though the validator (http://validator.w3.org) and the majority of errors were from the newsbox (at least 450 of them).
"You can get all A's and still flunk life." (Walker Percy)

crescens

Actually... it's still not working fully with the script...
http://crescens.xepher.net/fish/

:/

And once again, it's perfectly fine without the box: http://crescens.xepher.net/fish/index2.php

Databits

Did you put the configuration stuff in the function like I told you?
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

Well, the thing was it was working perfectly without it, and it broke as soon as I put it in, so I tried removing it to see if it's better.  And for some reason, it isn't. :/

Databits

what exactly is the code when you add the newsbox config stuff to it?
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]