Thanks for asking on the site. There are a few problems with the way you're trying to do this.
First: your controller, app/code/local/ness/so/indexcontroller.php
, should really exist in app/code/local/Ness/So/controllers/IndexController.php
-- as that's proper placement for Magento [ref]. The referenced article will also walk you through the process of registering that controller within your Ness_So
module.
Your paths are also wrong, both what you reference for rwd/default
(so maybe a typo?) and also your custom mysite/tree/myfile.phtml
cannot really exist at that location. Instead, it needs to share a similar directory structure as the other theme templates, eg: mysite/app/design/frontend/rwd/default/template/tree/myfile.phtml
.
After fixing that comes another learning point. Controllers and templates are separated by another layer in Magento called the block. This is a class which can render and serve the template. The job of the controller is to load the entire layout and trigger the rendering process from the top of the chain [ref].
Now you can alternatively circumvent a lot of that process by creating a block and assigning to it your template all within the controller. So that might look like this:
# File: app/code/local/Ness/So/controllers/IndexController.php
class Ness_So_IndexController
extends Mage_Core_Controller_Front_Action
{
// Example URL to hit this action: mysite.com/so/index/index
public function indexAction()
{
// Create a generic template block
$block = $this->getLayout()->createBlock('core/template');
// Assign your template to it
// This path is relative to your current theme (eg: rwd/default/template/...)
$block->setTemplate('tree/myfile.phtml');
// Render the template to the browser
echo $block->toHtml();
}
}
So while you can do anything you want with Magento using PHP, there are definitely some patterns that will work to your advantage once you learn them.
It sounds like you have a lot to learn about Magento, and that's great! In addition to the resources I've mentioned, here are some more to help you get started: