Author Topic: Yet another newsbox problem  (Read 19317 times)

0 Members and 1 Guest are viewing this topic.

crescens

  • Newbie
  • *
  • Posts: 20
    • View Profile
Yet another newsbox problem
« on: July 03, 2007, 01:26:36 am »
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

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #1 on: July 03, 2007, 01:29:15 am »
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.
« Last Edit: July 03, 2007, 01:32:18 am by Databits »
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Yet another newsbox problem
« Reply #2 on: July 03, 2007, 01:34:03 am »
I'm... actually not sure what that does either.
Well, I got rid of it, and it didn't make a difference. :/

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #3 on: July 03, 2007, 01:35:47 am »
Also note that:
Code: [Select]
<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):
Code: [Select]
<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?
« Last Edit: July 03, 2007, 01:38:00 am by Databits »
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Yet another newsbox problem
« Reply #4 on: July 03, 2007, 01:43:20 am »
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

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #5 on: July 03, 2007, 01:46:08 am »
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.
« Last Edit: July 03, 2007, 01:50:16 am by Databits »
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #6 on: July 03, 2007, 01:53:58 am »
Hmm my account here seems to have been locked, sorry can't help atm but try this anyhow:

Code: [Select]
<?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.
« Last Edit: July 03, 2007, 01:58:09 am by Databits »
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Yet another newsbox problem
« Reply #7 on: July 03, 2007, 02:00:34 am »
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

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #8 on: July 03, 2007, 02:01:44 am »
Add them into the function call at the top:

Code: [Select]
<?php
function renderXepherNewsbox() {
  
// Place your configuration constants here...

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

Xepher

  • Techsmith
  • Administrator
  • *****
  • Posts: 4,334
  • Illegitimis non carborundum!
    • View Profile
    • Xepher.net
Re: Yet another newsbox problem
« Reply #9 on: July 03, 2007, 03:14:44 am »
Hmm, I'll have to be more careful with code when I rewrite the newsbox. Glad ya'll got it figured out though.

griever

  • Sr. Member
  • ****
  • Posts: 457
    • View Profile
Re: Yet another newsbox problem
« Reply #10 on: July 03, 2007, 06:51:22 am »
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

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Yet another newsbox problem
« Reply #11 on: July 03, 2007, 07:28:02 am »
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

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #12 on: July 03, 2007, 02:32:29 pm »
Did you put the configuration stuff in the function like I told you?
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

crescens

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Yet another newsbox problem
« Reply #13 on: July 03, 2007, 05:30:56 pm »
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

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: Yet another newsbox problem
« Reply #14 on: July 03, 2007, 06:28:53 pm »
what exactly is the code when you add the newsbox config stuff to it?
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]