Gossamer Forum
Home : General : Internet Technologies :

Help with a PHP script?

Quote Reply
Help with a PHP script?
I'm working on an adaptation/extention of this PHP script, which parses news headlines from Moreover:

http://www.alexanderdevelopment.net/...code/moreoverxml.php

Basically, I'm trying to put the script itself into a function that references the other functions, so that I can include it and call the function as needed, rather than it having to run everytime it's loaded. (That was a mouthful, but hopefully you get the idea.) For some reason, though, when I put the main "business" into a function, it fails to return anything when called. I've done enough testing to be fairly confident that it is indeed parsing the XML file, it just isn't returning it to the page. I'm guessing this is some kind of namespace issue or something, but I just can't figure it out.

Anyone willing to take a stab at helping me out with this?

I've attached a stripped down version of what I'm currently working with.

Many thanks in advance for any suggestions!

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Help with a PHP script? In reply to
Hi Adam,

Attached should work.Smile

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Help with a PHP script? In reply to
Excellent! With a couple of minor edits (see attached) that works perfectly. Thanks so much for your help!

So we're able to put everything inside the function get_headlines() except for when we define the $open_tags and $close_tags arrays? Why is that? I tried seeing what would happen if I put them back inside the function and declared them as globals in all of the other functions, but it didn't work again. Why do those arrays need to be defined outside of the function? It's not a problem to keep them outside the function, but I'm just curious... Thanks again.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund

Last edited by:

hennagaijin: Oct 7, 2002, 4:47 AM
Quote Reply
Re: [hennagaijin] Help with a PHP script? In reply to
If you put these arrays into the get_headlines function, they will be local in that function and in others functions, they will be undef, as far as I know

Cheers,

Dat

Cheers,

Dat

Programming and creating plugins and templates
Blog