Hello again!
I would like to inform you that I still have questions about MODX cuz it's my first time I'm using CMS(MODX).until I'm familiar with Chunks TVs Templates and so on.. but about Snippets are not clear to me and I don't understand how can I connect to my database .someone can explain me very clear or send me a nice document about how I can create a PHP page and connect it to my database .Brief create registration ,login forms and store data into own database,cuz all documents I got weren't very clear to me .
Thank you for taking the time to consider my request, and I hope that you can assist me with this request. I appreciate your time and effort to get this done for me.
for frontend - registration and login you would use the login - extra.
what exactly do you have in mind with your database-connection?
The first thing I wanna do is to create members table where data for users will be stored like(Username,Full name,Email,Phone number,address,City,state,Zip,Country and so on..)that means my form must contain all text field. and Can u provide me log extra document please
-
☆ A M B ☆
- 24,524 Posts
For PHP functions, use snippets, and if the code needs to be inserted into the core processes somewhere use plugins and the MODX events. Snippets and plugins are processed internally by the MODX core, and have full access to the core API including the session and the database connection that MODX initializes at the start. Basically they act as a PHP include, and the index.php is the actual script that gets called to start MODX.
It is possible to create separate .php files, but in such a case you need to load the MODX core to get the MODX functionality.
https://rtfm.modx.com/revolution/2.x/developing-in-modx/other-development-resources/loading-modx-externally
It is seldom necessary - in fact I would go so far as to say that it is never really necessary. Snippets and plugins can be used to accomplish any function; if necessary a snippet can be called on a resource with no template and no other content besides the snippet tags. This method is often used for AJAX back-end processing.
There are installable add-ons for just about anything you could want to do. The Login add-on provides almost everything you could want to do with user management, and there are several supplementary add-ons that fill any gaps, such as Personalize or redirectUserGroups.
-
☆ A M B ☆
- 24,524 Posts
The Login package contains several snippets for various user management functions, such as registration, changing passwords, listing and editing profiles. It uses the basic MODX user database tables, and enables using the MODX ACL permissions system for the front-end.
https://rtfm.modx.com/extras/revo/login
you don't need to create the user-table and user-management by yourself.
This is allready build-in with MODX.
If you have very special use-cases you can extend the modx-user with
http://modx.com/extras/package/classextender
but in many cases, you can use the build-in extended-field for additional user-informations.
I'm trying the following code but doesn't work
<h2>Register</h2>
[[!Register?
&submitVar=`registerbtn`
&activationResourceId=`12`
&activationEmailTpl=`myActivationEmailTpl`
&activationEmailSubject=`Thanks for Registering!`
&submittedResourceId=`45`
&usergroups=`Marketing,Research`
&validate=`nospam:blank,
username:required:minLength=^6^,
password:required:minLength=^6^,
password_confirm:password_confirm=^password^,
fullname:required,
email:required:email`
&placeholderPrefix=`reg.`
]]
<div class="register">
<div class="registerMessage">[[!+reg.error.message]]</div>
<form class="form" action="[[~[[*id]]]]" method="post">
<input type="hidden" name="nospam" value="[[!+reg.nospam]]" />
<label for="username">[[%register.username? &namespace=`login` &topic=`register`]]
<span class="error">[[!+reg.error.username]]</span>
</label>
<input type="text" name="username" id="username" value="[[!+reg.username]]" />
<label for="password">[[%register.password]]
<span class="error">[[!+reg.error.password]]</span>
</label>
<input type="password" name="password" id="password" value="[[!+reg.password]]" />
<label for="password_confirm">[[%register.password_confirm]]
<span class="error">[[!+reg.error.password_confirm]]</span>
</label>
<input type="password" name="password_confirm" id="password_confirm" value="[[!+reg.password_confirm]]" />
<label for="fullname">[[%register.fullname]]
<span class="error">[[!+reg.error.fullname]]</span>
</label>
<input type="text" name="fullname" id="fullname" value="[[!+reg.fullname]]" />
<label for="email">[[%register.email]]
<span class="error">[[!+reg.error.email]]</span>
</label>
<input type="text" name="email" id="email" value="[[!+reg.email]]" />
<br class="clear" />
<div class="form-buttons">
<input type="submit" name="registerbtn" value="Register" />
</div>
</form>
</div>
-
☆ A M B ☆
- 24,524 Posts
Have you followed all of the steps here
https://rtfm.modx.com/extras/revo/login/login.tutorials/login.request-membership
I can assure you that this does work. I have a very bad memory and have to refer to this tutorial every time I set up a registration page.
Login was installed by package-management?
"It doesn't work" doesn't tell us enough to help you.
See this:
http://bobsguides.com/blog.html/2013/04/21/getting-help/