Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Methods to include and return

How to pass things back from remote includes...

5:14 pm on Nov 30, 2004 (gmt 0)

New User

10+ Year Member

joined:Nov 30, 2004
votes: 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.


5:18 pm on Nov 30, 2004 (gmt 0)

New User

10+ Year Member

joined:Nov 30, 2004
votes: 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.

12:18 am on Dec 1, 2004 (gmt 0)


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

joined:Apr 25, 2002
votes: 102

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.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members