1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How does Zend/XF do MVC?

Discussion in 'XenForo Development Discussions' started by Razasharp, Feb 15, 2014.

  1. Razasharp

    Razasharp Well-Known Member

    I think I am getting a bit confused.

    What I'm used to is creating an action in a controller, and setting up the variables for that action.

    Those variables can them be passed down into templates (partials) inside that action. If an object in a collection requires further associated variables/objects, these can be set up in helpers.

    Is this how XF/Zend does things too? If I want to get some info from the xf_forum table, to show on the forum home page (for the 'last post' info ) what would be the best way to go about it?

    Looking at the indexAction in Forum.php (controller) I see this:

    		$viewParams = array(
    			'nodeList' => $this->_getNodeModel()->getNodeDataForListDisplay(false, 0),
    			'onlineUsers' => $this->_getSessionActivityList(),
    			'boardTotals' => $this->_getBoardTotals()
    And it seems I need the first line, which points to the class XenForo_Model_Node extends XenForo_Model. But I'm not really sure where to go from there.

    Any ideas? Or tips in general to understand the XF/Zend way? How would I get data that is stored in the xf_forum table to be made available in the correct views?

    (I've been through some PHP tuts and XF dev tuts, but still feel a little lost - sorry for posting so many questions).
  2. Razasharp

    Razasharp Well-Known Member

    Thanks for the reply and snippet @AndyB it's very helpful seeing code doing similar.

    I think I am just finding it hard to find my way around XF/Zend :/ or maybe I am just expecting to know too much too soon. I'll try and go through more tuts and see how I get on.

    Thanks for your help.

Share This Page