This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

g.vanto67453
g.vanto67453

I have a signup.htm page file and have been adding some php code to the tab next to markup, which I noticed saves as part of the signup.htm file. I can open the signup.htm page in my editor (phpStorm) but it's not very code-friendly (autocomplete, highlighting, links to use statements, etc, etc) ... as a PHP developer I am used to these features, especially when it comes to doing complex PHP stuff (which I'll be needing to do shortly). (the PHP editor in the CMS Editor is great for basic stuff).

What I'd like to know is whether it's possible to call a local-living (ie not php markup part of cms page) PHP code from within form processing function?

function onFormSubmit() { $service = new AccountCreateService(); //lives somewhere in file system and can be edited in a normal PHP editor such as PhpStorm

  $service->createAccount(...formInputStuff...)

}

Many thanks for any help, g

Last updated

g.vanto67453
g.vanto67453

RTFMed some, this is all achievable with plugins. Super nice

Eoler
Eoler

g.vanto67453 said: I have a signup.htm page file and have been adding some php code to the tab next to markup, which I noticed saves as part of the signup.htm file. I can open the signup.htm page in my editor (phpStorm) but it's not very code-friendly (autocomplete, highlighting, links to use statements, etc, etc) ... as a PHP developer I am used to these features, especially when it comes to doing complex PHP stuff (which I'll be needing to do shortly). (the PHP editor in the CMS Editor is great for basic stuff). What I'd like to know is whether it's possible to call a local-living (ie not php markup part of cms page) PHP code from within form processing function?

Yeah, do everything in components (MVVM/frontend controllers) and Twig, preferably with AJAX framework. Bonus: configure PhpStorm to highlight .htm files as Twig. Enjoy!

g.vanto67453
g.vanto67453

Ok awesome thanks @Eoler, will check that out. Loving this CMS ...

g.vanto67453
g.vanto67453

@Eoler I've tried adding .htm files as Twig in PhpStorm (according to this post: https://craftcms.stackexchange.com/questions/10137/twig-syntax-highlighting-in-phpstorm) but I can't see any formatting / autocompleting being applied - did you do it in the above way?

Eoler
Eoler

g.vanto67453 said: @Eoler I've tried adding .htm files as Twig in PhpStorm (according to this post: https://craftcms.stackexchange.com/questions/10137/twig-syntax-highlighting-in-phpstorm) but I can't see any formatting / autocompleting being applied - did you do it in the above way?

No, I've simply added *.htm to File name patterns list in Twig (Recognized File Types).

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.