Question on error handling from a remote site displaying blog entry
-
I have a WordPress blog and a website separate. The blog is located in http://www.domain.com/blog and the website is located in http://www.domain.com (the same domain)
On my website, however, I’m showing an excerpt of the latest blog entry using the following code:
<?php require(‘blog/wp-blog-header.php’);
query_posts(‘showposts=1’);
while (have_posts()) : the_post();?>
<?php the_date(); ?> — <?php the_title(); ?>
<?php the_excerpt(); ?>
<p>” target=”_blank” rel=”bookmark”>Go to blog</p>Now, all of this is working perfectly, however, when I am working locally with my website the script obviously does not work, because there is no database set up locally for the blog. What then happens is that the script displays a warning message looking something likes this:
Warning: Cannot modify header information – headers already sent by (output started at C:webspage.php:2) in C:websblogwp-includesfunctions.php on line 1583
Error establishing a database connectionalso, after the error message, the website stops displaying anything after the point where the excerpt would have been displayed.
This is obviously a minor problem that does not have any functional benefit other than to me as I am programming, however, I was wondering if there is a possibility to insert a die function somewhere in the above code that will display a simple error message and then continue displaying the rest of the page.
This would also help in case I decide to make major modifications to the database on my server or anything else which might cause a similar problem.
Thank you for any help and assistance!
Cheers!
-
-
You’re in the wrong forum. We use different software here. Head over to http://wordpress.org/support
-
- The topic ‘Question on error handling from a remote site displaying blog entry’ is closed to new replies.