Tag Archives: Programming

Windows live writer’s "Invalid response document" error

In my previous post, I outlined my unsuccessful attempt to use windows live writer (WLW) to connect to the XmlRpc server of PhpWebsite‘s article manager module. I experimented using both the Metaweblog API and the Movable Type API but with no success. When attempting to post an entry, WLW always returned the following error message “The response to the metaWeblog.newPost method received from the weblog server was invalid: Invalid response document returned from XmlRpc server.” However, the entry did get posted. Republishing the same entry would create a new post instead of replacing the one posted earlier. And each time, WLW gave the same error. 

I searched the Internet for possible solutions. I found out that the problem is quite common and not unique to PhpWebsite (PWS).  The same problem has also been observed in other blogging platforms such as wordpress. Luckily for wordpress users, there are already solutions posted in several blogs for some of the problems with WLW. Unfortunately for me, the solutions were not applicable for PWS. I could not even find other sites or blogs talking about PWS and WLW except this one. It seems I am the only soul trying to do this in the entire world wide web.

Since most of the websites I’m maintaining are powered by PWS, I thought it is worth the time and effort to figure out the cause of the problem. I am also in need of a good editing application that I can use with PWS. The provided text editor is only good for basic editing and not for more advanced formatting. For instance, using tables in entries can really take a lot of time. Anyway, since I am using WLW in my other blogs, I thought it would be great if I could also use it in my PWS-based websites.

News Ticker for PhpWebSite

In this post, we will combine the two scripts described in the last two entries, namely, A Javascript News Ticker and Extending phpWebSite for mobile access, into a single script that will display in a news ticker the most recent articles of your (phpWebSite) PWS-based website. The functions defined in these two articles will be reused here with minimal modifications. So if you have not yet read these articles, this is the right time to do so. Simply click the link provided above and return here afterwards.

To incorporate the new script into phpWebSite, we will use theme.php and theme.tpl included in every phpWebSite theme. theme.tpl defines the overall layout or template of your site, while theme.php facilitates the inclusion of php files into phpWebSite. We will be manipulating these two files in order to include the php script for our news ticker. But before this, we will first describe the script itself.

The basic idea is to use the javascript described in the news ticker article for the news ticker part. But instead of hard-coding the title and link arrays, as we did before, we will use the script in Extending phpWebSite for mobile access article to extract the titles and links of the most recent articles in your PWS-based website. We then output everything into a <script> html tag and insert this into phpWebSite using theme.tpl.

A Javascript News Ticker

News tickers are common in news websites. A news ticker is usually used to draw user’s attention to the site’s latest news headlines. It can also provide a direct link to the displayed news item so that readers can immediately access the full content from anywhere within the site. One such ticker can be seen at the Philippines Today website. This post describes how to create a simple news ticker you can use on your own website using javascript.

To start with, we define two arrays. One contains the titles of the news items to be displayed and the other the links to access these items. Here, we will explicitly specify the titles and the links within the code for simplicity. Other methods, such as via RSS, can be used to implement automatic retrieval of titles and links that will be displayed in the ticker. But this will not be covered here. Our first javascript code will be like this:

Extending phpWebSite for mobile access

I have been using phpWebsite in a couple of websites I am administering. It provides a complete content management system and has several modules you can use in order to customize the contents of your site. You can exclude features you don’t need and install only the ones you will use. Most of all, phpWebsite is free and developed using PHP, an HTML-embedded scripting language that I am familiar with.

Recently, I have been thinking of providing a text-only version of my websites so that the contents can also be viewed using web-enabled mobile phones or text-only browsers. What I want for the text-only version is to have an index page that will display the title of the most recent entries with links to the full article and an entry page that will display the full content of a given article.

I started searching the Internet for a third party phpWebSite module that would do the trick, but to no avail. Because of this, I decided to make one myself. Since I am not still familiar with the inner workings of phpWebSite and how its modules are organized, I decided to make a script that is independent from it, not a phpWebSite module. However, the script will still be pulling out data from the phpWebSite database and possibly recycle some of the pre-defined functions already available in the package. Hopefully, I can rewrite the script as a full-pledged module in the future. The script’s organization and code is summarized next.