We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

SignupController/indexAction keeps falling back on public/index.phtml instead of public/signup/index.phtml

Topic says it all... I've followed the installation guide meticulously, and tried several different approaches... but I still can't figure out why my controller falls back on the wrong template:

my VHOST (per https://docs.phalcon.io/en/latest/reference/apache.html)

<VirtualHost *:80>

    ServerAdmin [email protected]
    DocumentRoot "/usr/webroot/test/public/"
    DirectoryIndex index.php
    ServerName foobar.com
    ServerAlias test.foobar.com

    <Directory "/usr/webroot/test/public/">
        Options All
        AllowOverride All
        Allow from all
    </Directory>

</VirtualHost>

.htaccess in '/usr/webroot/test/public/'

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

I know the SignupController is being invoked because if i echo/exit in indexAction i see the echo, but for some reason it keeps falling back on the /public/index.phtml template instead of using /public/signup/index.phtml.

any ideas?



98.9k

/public/signup/index.phtml. is not a correct path for a view, it must be app/views/signup/index.phtml



592

sorry that was a huge typo my folder structure is correctly configured as per the tutorial

i have: app/controllers/IndexController.php app/controllers/SignupController.php app/views/index.phtml app/views/signup/index.phtml

but for some reason 'SignupController' uses the 'app/views/index.phtml' view

however the link



3.6k

I have the exact same problem!

Have someone found a solution?



8.1k

Your controller use 'app/views/index.phtml as layout, may be. But not use app/views/signup/index.phtml And, if you use phalcon 1.2.4., you can have a bug with register case of directory name. See https://github.com/phalcon/cphalcon/issues/1541 The solution is simple.