Forums

WP MVC
Including views on other pages? (2 posts)

  1. jarednova
    Member
    Posted 1 year ago #

    Hey there,

    Anyone know how to properly add a view to other pages (like home)?

    For example, let's say I have a list of Schools (and a corresponding set of views, model, controller, etc.) -- that I want to appear on the WP home page. I can def hack it -- but what's the best practice way to call a view I create with WP-MVC and put it on my home page?

    Thanks!

    http://wordpress.org/extend/plugins/wp-mvc/

  2. tombenner
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Currently, the best way to do this is to use the mvc_render_to_string() function. There isn't support yet for using a controller's action in this context, but you can easily access models and data using mvc_model(). Here's an example:
    http://wpmvc.org/documentation/88/mvc_render_to_string/

    There are other mvc_*() functions that may be useful to you in code that's outside of the WP MVC context, too:
    http://wpmvc.org/documentation/74/functions/

    Best,
    Tom

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags