Multiple views in controller

Permalink
Hi!

I have a controller file in application/controllers/folder/payment.php and a view file in applications/views/folder/payment.php

in app.php i have declared the following:
Route::register('/folder/payment', '\Application\Controller\Folder\Payment::view');


payment.php controller:
<?php
namespace Application\Controller\Folder;
use Controller;
class Payment extends Controller
{
   protected $viewPath = 'folder/payment';
   public function on_start()
   {
   }
   public function view()
    {
        /** view code */
      $this->set('param', 'value');
    }
}


payment.php view:
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>
<-- Lots of HTML statics -->
<?= $param; ?>


I now want to extend my controller to use another view as well. How do I do that?

I've tried to add a function named 'other' in controller and then in app.php add:
[code]Route::register('/folder/payment/other', '\Application\Controller\Folder\Payment::other');[code]

But this still render what is at $viewPath. Is it possible to redeclare this?

Thanks!

 

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.