/    Sign up×
Community /Pin to ProfileBookmark

complicated includes problem

I am trying to include a file from within a directory.
my layout is like this:

main/search.php

main/includes/search_function.php

main/template/search.tpl.php

inside my search_function.php I want to include a file if no results exist.

my php looks like this:

[code=php] if ($results)
{
$browse_content .= ‘<td valign=”top” class=” ‘.$background.'” width=”180″><div id=”contentF”> so on and so forth…’;
}
else
{
$browse_content = include(‘no_results.php?q=’ . $_REQUEST[‘keywords’] . ”);

}[/code]

I cannot get the file to “include”, i tried several ways, also like this:

[code=php] else
{
include(‘no_results.php?q=’ . $_REQUEST[‘keywords’] . ”);
}[/code]

How would i go about this?? do I need an absolute url or??

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@adam_jimenezJun 01.2009 — doesn't work like that. you include files via the filesystem not http.

if u want to do http u can use

[code=php]$browse_content = file_get_contents('http://domain.com/no_results.php?q=' . $_REQUEST['keywords']);[/code]
Copy linkTweet thisAlerts:
@72newbieauthorJun 01.2009 — ok, now I'm getting a Tstring error, my url is more complex than I showed, it is a google search string....

no_results.php?cx=partner-pub-4754376389891817%3A3y5f8k-6jx9&cof=FORID%3A10&ie=ISO-8859-1&q=' . $_REQUEST['keywords'] . '&sa=Search#774

??
Copy linkTweet thisAlerts:
@adam_jimenezJun 01.2009 — [code=php] $browse_content = file_get_contents('http://domain.com/no_results.php?cx=partner-pub-4754376389891817%3A3y5f8k-6jx9&cof=FORID%3A10&ie=ISO-8859-1&q=' . $_REQUEST['keywords'] . '&sa=Search#774'); [/code]
×

Success!

Help @72newbie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...