Solved

Include HTML in Wordpress SideBar.php

Posted on 2011-03-22
6
331 Views
Last Modified: 2013-12-13
I want to include some HTML within the sidebar.php and I get the error below.

My code in sidebar.php:
<?php include 'mypage.html'; ?>


Error msg:
PHP Warning:  include() [<a href='function.include'>function.include</a>]: URL file-access is disabled in the server configuration in D:\Sites\mysite.co.uk\public_html\blog\wp-content\themes\sduk\sidebar.php on line 81
PHP Warning:  include(http://www.mysite.co.uk/includes/mypage.html) [<a href='function.include'>function.include</a>]: failed to open stream: no suitable wrapper could be found in D:\Sites\mysite.co.uk\public_html\blog\wp-content\themes\sduk\sidebar.php on line 81
PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening 'http://www.mysite.co.uk/includes/mypage.html' for inclusion (include_path='.;C:\php\pear') in D:\Sites\mysite.co.uk\public_html\blog\wp-content\themes\sduk\sidebar.php on line 81

Can someone help?

I don't want to change it to .php as I want to use the same include in an .ASP page.

Thanks.
0
Comment
Question by:benners70
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:stopReplying
Comment Utility
Try renaming your page from mypage.html to mypage.php and include it.
0
 
LVL 2

Expert Comment

by:stopReplying
Comment Utility
Also, mypage.html must be in the same folder as sidebar.php (sorry for the post above, failed to read the question entirely)
0
 

Author Comment

by:benners70
Comment Utility
It does seem to work if I put the file in the same folder. I should have been more accurate with my question. The code I was using was:

<?php include 'http://www.mydomain.com/inc/mypage.html'; ?>

and this gave the error. If I put the file in the same folder as sidebar.php and use the following it works.

<?php include 'mypage.html'; ?>

I'd rather not have it in the same folder. Is there a way I can use the exact URL?
0
 
LVL 2

Accepted Solution

by:
stopReplying earned 125 total points
Comment Utility
For example, if sidebar.php is in root folder and mypage.html is in inc folder, include inc/mypage.html

If you need to go up one level (for example if you have sidebar.php in root/folser/sidebar.php and mypage is in root/inc/mypage.html) include '../inc/mypage.html'
../ is equal to 'up' button in windows explorer.
0
 

Author Comment

by:benners70
Comment Utility
Thank you, I have it working now with.

<?php include '../includes/mypage.html'; ?>
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now