0

I am currently coding a website and I have a global sidebar. I want every file to have the sidebar and just be able to update my sidebar.php and everything will change, but when I put in

<div><?php include 'sidebar.php'; ?></div>

it doesn't work. I've also tried

<div><?php include 'jophnist.x10.bz/sidebar.php'; ?></div>

Whenever I do that though, it gives me this warning.

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/jophnist/public_html/games/index.php on line 5

Warning: include(http://jophnist.x10.bz/sidebar.php): failed to open stream: no suitable wrapper could be found in /home/jophnist/public_html/games/index.php on line 5

Warning: include(): Failed opening 'http://jophnist.x10.bz/sidebar.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jophnist/public_html/games/index.php on line 5

What do I do? When I try

<iframe src="http://jophnist.x10.bz/sidebar.php" seamless></iframe>

it works, although it is too small and the words in the file don't go in the sidebar.

1 Answer 1

1

I couldn't see your include statement in the question above. But I assume that it's something like:

include('http://jophnist.x10.bz/sidebar.php');

Is that right? If so, instead of passing a url to include, pass a relative path to the sidebar.php file from the current file. If they are in the same directory, use:

include('sidebar.php');

or say for example the files from which you're including sidebar.php are in a subdirectory while sidebar.php is in the main diretory, use:

include('../sidebar.php');

It is possible to pass a url to include in php, if you enable the http file wrapper for includes in php config, but that is very much discouraged since it can cause major security problems.

Sign up to request clarification or add additional context in comments.

1 Comment

OK I can see your include code now. What error message do you get from your include 'sidebar.php'; ? Could you post the directory structure you're working in, i.e. where is the sidebar.php file relative to the files you're including from?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.