Controllers

Permalink
Hi,

I've created a Page called "reset-password" , that page uses a template called "Basic" and that template I has an area called "content".

The content of that "content area" contains a form.

How do I declare a controller that can access this form ? and to which I could also post the data ?

Thank you for any help or idea

 
jakobfuchs replied on at Permalink Reply
jakobfuchs
Have you tried the Form Block that comes with Concrete5?

If that's not enough for you, you should look into Single Pages:http://www.concrete5.org/documentation/developers/5.7/working-with-...
ses replied on at Permalink Reply
Yes that did the trick, create a single_page and put the template through the view.php in the themes folder, does exactly what I need.

Anyhow, the controller is not called, do you have any clue why ?

the folder structure is the following :

application
   -- controllers
       -- chat
           -- controller.php
   -- single_page
       -- chat
           -- view.php
   -- themes
       -- mytheme
          -- view.php

the theme view.php and single_page view.php are correctly rendered however the controller is not called, this is my controller code :

<?php
  echo "I'm a controller"; exit;



Thnx,
Serge
WebcentricLtd replied on at Permalink Reply
how about:

public function view() {
echo "I'm a controller";
}
ses replied on at Permalink Reply
No, it's not the problem, the problem is that the system never calls/executes the file controllers/chat/controller.php

It looks like if Concrete5 would expect the file in another folder
WebcentricLtd replied on at Permalink Reply
I have single pages set up like so:

application/single_pages/....
application/controllers/single_page/....
ses replied on at Permalink Reply 1 Attachment
hmm, still no effect.

Very very strange, could it be related to the php version ?, I'm using 5.6.10 ?

Serge
WebcentricLtd replied on at Permalink Reply
what happens if you start from scratch, have the controller in the correct place when you register the single page and have the controller with the correct namespace, use statements and it properly extends the page controller class?
ses replied on at Permalink Reply
still no effect.

namespace Application\Controller\SinglePage;
use Concrete\Core\Page\Controller\PageController;
class Chat extends PageController
{
    public function view()
    {
        echo "hello";
    }
}
MrKDilkington replied on at Permalink Reply
MrKDilkington
@ses

Here are two examples to try.

Example: named view file (donut.php)
- single page
application\single_pages\donut.php
- single page code
<h1><?php echo $test; ?></h1>

- single page controller
application\controllers\single_page\donut.php
- single page controller code
<?php
namespace Application\Controller\SinglePage;
use Concrete\Core\Page\Controller\PageController;
class Donut extends PageController
{
    public function view()
    {
        $this->set('test', 'test value');
    }
}

Example: view file as view.php
- single page
application\single_pages\donut\view.php"

The rest of the steps would be the same as the first example.