?
Solved

Include HTML in Wordpress SideBar.php

Posted on 2011-03-22
6
Medium Priority
?
381 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
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…
Suggested Courses

801 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