I'm trying to implement this tutorial in my Craft CMS site, I've created all the files and they currently reside in public_html, but twig and the .htaccess of Craft CMS is interfering with it.

Does anyone know what the directory structure should look like to integrate this with craft cms or whether it's possible by other methods?

Appreciate any help.


If you're trying to create a front-end login form, I'd suggest using this as a starting point: https://docs.craftcms.com/v3/dev/examples/login-form.html

| improve this answer | |
  • I want to add a login for users of the site, not for the admin section, that link is for the admin section right?, I deleted the tutorial I put in the question as it was apparently really bad code, I followed a better tutorial that works perfectly but just trying to convert $_SESSION to Twigs session object now, not really sure how to do it. – JTR Jul 19 '19 at 6:39
  • A user is a user in Craft and they either have permissions to access the Control Panel or they don't. So the link above allows you to create a login form on the front-end of the site so they'll have a valid PHP/Craft session. – Brad Bell Jul 19 '19 at 18:59
  • If what I'm thinking is right then I just waisted a lot of time haha, so what you're saying is all I have to do is create a user in the Craft CMS settings section and then put that code in my front-end and, then I can apply twig to display certain things on my craft templates to those users so "Welcome, {{ session.username }}"? I thought that login form was a front-end method of reaching the CMS, if it isn't then that sounds exactly like what I want. – JTR Jul 20 '19 at 2:50
  • Also this seems only possible with Craft Pro, but I guess I'm just going to have to get that. – JTR Jul 20 '19 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.