Skip to content

Instantly share code, notes, and snippets.

@mlangenberg
Created September 9, 2008 14:00
Show Gist options
  • Save mlangenberg/9679 to your computer and use it in GitHub Desktop.
Save mlangenberg/9679 to your computer and use it in GitHub Desktop.
# locatie: /app/views/wordpress/page_view.rb
class PageView
def initialize(page)
@page = page
end
def get_page
XMLRPC::Marshal.dump_response(
{
:page_id => @page.id,
:title => @page.title,
:description => @page.description,
:link => "/pages/#{@page.id}", #url(:page, @page),
:wp_page_parent_id => @page.parent_id,
:wp_page_order => @page.page_order,
:wp_page_parent_title => @page.parent.title
})
end
end
# locatie: /app/controllers/wordpress.rb
class Wordpress < Application
only_provides :xml
def get_page
current_site.authenticate(params[:username], params[:password])
@page = current_site.find_page(params[:page_id])
PageView.new(@page).get_page
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment