Hi,

I posted this thread: https://forum.owncloud.org/viewtopic.php?f=26&t=19712
and was told, that it would be a better choice to join this mailing list.
Since this problem changed a little, here the update:

I'm still at the beginning of the template, but somehow it's partly working now. I'm not sure, what I actually changed, but never mind.
So the problem that needs to be resolved is this:
I want to be able to access an array from within my template file, for that I use in the controller file following code:
<?php
function index(){
$query = \OCP\DB::prepare("SELECT * FROM *PREFIX*msg WHERE message_to=?");

        $results = $query->execute(array(USER::getUser()));

        $message = $results->fetchAll();
        $response = new TemplateResponse($this->api, 'main');
        $response->renderAs("user");
        $params = array('messages' => $message,
                'msg' => "hallo sch welt...");
        $response->setParams($params);
        $response->render();
        return $response;
}

(including all necessary Libraries and index part of an object called PageController, which extends Controller -> like in the Tutorial of owncloud)

Now I try to access these by doing:
foreach ($_["messages"] as $msg){
    p($msg);
    p($msg["message_content"]);
}
in my main.php (in template folder)

I'm expecting the output "array" and "somevalue" from my database, but instead nothings shows up. No errors are being logged, so what am I missing?

thanks,
Nils Pöhlmann
_______________________________________________
Devel mailing list
[email protected]
http://mailman.owncloud.org/mailman/listinfo/devel

Reply via email to