[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Include HTML in Wordpress SideBar.php

Posted on 2011-03-22
6
Medium Priority
?
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

656 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