Solved

Include HTML in Wordpress SideBar.php

Posted on 2011-03-22
6
345 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
ID: 35188916
Try renaming your page from mypage.html to mypage.php and include it.
0
 
LVL 2

Expert Comment

by:stopReplying
ID: 35188930
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
ID: 35189373
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
ID: 35189528
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
ID: 35189735
Thank you, I have it working now with.

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 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

19 Experts available now in Live!

Get 1:1 Help Now