homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Methods to include and return
How to pass things back from remote includes...

10+ Year Member

Msg#: 5935 posted 5:14 pm on Nov 30, 2004 (gmt 0)


I am working on a system, where I have sets of templates, and a special php file that reads from a database, and parses the templates, to display data in different formats.

The templates are generally used just as an addition to a regular html page (to do things like display latest news etc.), and so are included via SSI:


This instucts the parsing code to parse the template, latest_news.html, 5 times using table 20 from the database.

This all works fine.

However, in some cases, I want to return, say, a list of categories to use in my next include. I understand I can return data from includes, if they are done locally (ala include("/htdocs/parser.php")).

So my problem boils down to 2 things, one of which I need to solve:

- I cannot pass things to a local include (can I?) - such as the source, template, number of items etc... Could I fake a QUERY_STRING environment variable? Other options?

- I cannot retrieve data from a remote include in a regular manner. Could I redirect the output from an remote include into a local variable, (returning it in a semicolon delimited nature) then parse that? (There will only ever be about 5-6 short text strings I need returned).

I know this is a lot of input all at once, and I am maybe missing something obvious, so thanks for bearing with me.

I should mention, that my data source is used for a forums system, and so I am working within certain constraints on how I can go about this.




10+ Year Member

Msg#: 5935 posted 5:18 pm on Nov 30, 2004 (gmt 0)

Sorry, I forgot to mention...

I am aware that a local include can use local variables, so I could pass information in that manner, but the parse.php document originated from another authors code, and is a very heavy file, which would be a lot of hassle to disentangle to have work by including in then calling the functions within as I need.


WebmasterWorld Administrator ergophobe us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 5935 posted 12:18 am on Dec 1, 2004 (gmt 0)

I cannot retrieve data from a remote include in a regular manner

I don't really follow, but why can't you use data from a remote include? And why are the variables in the rest of the script out of scope? Normally all variables that are defined at the moment of the include are available within the include. Any variables that are defined later are unavailable.

Sorry, but I'm not sure what I'm missing in your question.


PS - I just saw that you're new. Welcome to WebmasterWorld! You might want to read the new member welcome thread to get yourself oriented.


It's a helpful resource.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved