Jump to content

Newbie coming from MODx


ankh2054
 Share

Recommended Posts

Hi All,

I am feeling very lucky at present stabling across processwire, it seems very powerful and sounds like it would scale much better than MODx.

I wanted to to just ask a few questions before I  make the move from MODx, so if anyone wants to be so kind:) Having no real PHP experience, albeit I can quite happily use PHP operators such as ==, != , if, else etc.... Would it be easy enough for someone like me to create the following elements:

  1. Registration, Login, logout processes and use profiles
  2. Ability for users to create pages
  3. Add a voting/polling buttons (yes/no) to user created pages

thanks so much for the help.

Charles

  • Like 1
Link to comment
Share on other sites

Hi ankh2054 and welcome to the forums!

We also switched from MODX to PW little over year ago and haven't look back since.

1. Yes, dealing with users and permissions is really straight forward with PW - here's a good thread to begin with: https://processwire.com/talk/topic/107-custom-login/

2. Simple as american pie: https://processwire.com/talk/topic/352-creating-pages-via-api/

3. Everything's possible, here's some discussion: https://processwire.com/talk/topic/218-simple-poll/

There's lot of goof stuff in the forums and Google is your best friend!

  • Like 2
Link to comment
Share on other sites

Exact same reaction as you ankh2054 when I stumbled across PW (thanks to Marty Walker whose site I found and saw PW mentioned).

I have not regretted or looked elsewhere since and I have actively re-built some sites from other CMSs to PW JUST for my own benefit.

Welcome and enjoy!

  • Like 5
Link to comment
Share on other sites

Also an ex-MODx'er myself.

It's been fun converting some very different sites over the past few years as things that required a lot of custom code and queries in snippets in MODx to something that's much more manageable using the API in ProcessWire templates.

Kidderminster-Husum-Twinning

Before: https://web.archive.org/web/20130726180253/http://www.kidderminster-husum-twinning.co.uk/

After: http://www.kidderminster-husum-twinning.co.uk/

StrategyCore

Before: https://web.archive.org/web/20120118171718/http://strategycore.co.uk/

After: http://www.strategycore.co.uk/

Etc etc :)

  • Like 3
Link to comment
Share on other sites

Greeting,

I'm always a bit jealous of you ex MODx-ers. At least you came from a decently flexible system, which got you using some proper pratices, and (I think) you could convert some sane code into ProcessWire materials.

For those of us who came from Joomla, not only was there nothing to re-use, but Joomla encourages such bad coding habits it takes a while to convert your sites and adjust your thinking.

But the bottom line is: we're here now!

Thanks,

Matthew

  • Like 2
Link to comment
Share on other sites

Hi all, just a quick question on best practice aka making life easier.

I have created a template = home.php ( which contains my headers, footers, javacript, navbar)

This is my base template.

I have now  followed a tutorial and created a login.php file and login template, but apart from the actual Login form and the login PHP the template is the same. Ideally I would like to just re-use the home template for this page and only add the custom HTML and custom PHP. 

How do others do this?

<?php

if($user->isLoggedin()) {
    // user is already logged in, so they don't need to be here
    $session->redirect("/"); 
}

// check for login before outputting markup
if($input->post->user && $input->post->pass) {

    $user = $sanitizer->username($input->post->user);
    $pass = $input->post->pass; 

    if($session->login($user, $pass)) {
        // login successful
        $session->redirect("/"); 
    }
}

?>

<!DOCTYPE html>
<html lang="en">

    <?php include("./head.inc"); ?>

    <?php include("./navbar.inc"); ?>

<div class="container">
         <div class="row">
         
    <div class="container">
        

        <div class="omb_login">
            <h3 class="omb_authTitle">Login or <a href="#">Sign up</a></h3>
            <div class="row omb_row-sm-offset-3 omb_socialButtons">
                <div class="col-xs-4 col-sm-2">
                    <a href="#" class="btn btn-lg btn-block omb_btn-facebook">
                        <i class="fa fa-facebook visible-xs"></i>
                        <span class="hidden-xs">Facebook</span>
                    </a>
                </div>
                <div class="col-xs-4 col-sm-2">
                    <a href="#" class="btn btn-lg btn-block omb_btn-twitter">
                        <i class="fa fa-twitter visible-xs"></i>
                        <span class="hidden-xs">Twitter</span>
                    </a>
                </div>  
                <div class="col-xs-4 col-sm-2">
                    <a href="#" class="btn btn-lg btn-block omb_btn-google">
                        <i class="fa fa-google-plus visible-xs"></i>
                        <span class="hidden-xs">Google+</span>
                    </a>
                </div>  
            </div>

            <div class="row omb_row-sm-offset-3 omb_loginOr">
                <div class="col-xs-12 col-sm-6">
                    <hr class="omb_hrOr">
                    <span class="omb_spanOr">or</span>
                </div>
            </div>

            <div class="row omb_row-sm-offset-3">
                <div class="col-xs-12 col-sm-6">    
                    <form class="omb_loginForm" action="./" accept-charset="UTF-8" autocomplete="off" method="POST">
                        <div class="alert alert-error fade-in alert-dismissable">
                        <?php if($input->post->user) echo "<hf class='alert-heading'>Login failed</hf>"; ?>
                        </div> 
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa fa-user"></i></span>
                            <input type="text" class="form-control" name="user" placeholder="Username">
                        </div>
                        <span class="help-block"></span>
                                            
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa fa-lock"></i></span>
                            <input  type="password" class="form-control" name="pass" placeholder="Password">
                        </div>
                        <span class="help-block"></span>
                        <input class="returnUrl" type="hidden" name="returnUrl" value="[[+request_uri]]" />

                   
                    
                    <input class="loginLoginValue" type="hidden" name="service" value="login" />

                        <button class="btn btn-lg btn-primary btn-block" type="submit" name="submit" value="Login">Login</button>
                    </form>
                </div>
            </div>
            <div class="row omb_row-sm-offset-3">
                <div class="col-xs-12 col-sm-3">
                    <label class="checkbox">
                        <input type="checkbox" name="rememberme" value="1" checked="checked">Remember Me
                    </label>
                </div>
                <div class="col-xs-12 col-sm-3">
                    <p class="omb_forgotPwd">
                        <a href="[[~5]]">Forgot password?</a>
                    </p>
                </div>
            </div>          
        </div>

 </div>

    <?php include ("./foot.inc"); ?>
 </div>
<?php include ("./java.inc"); ?>

</body>
</html>

Link to comment
Share on other sites

Welcome to PW and the forums Charles :-)

There are various ways of reusing markup/code, ranging from the simple include('/path/to/file/') to more complex but highly flexible approaches such as those discussed on this thread: https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/

If you are new to PHP (and that you are new to PW)...you probably do not want to start with the 'complex' approaches :-)

Link to comment
Share on other sites

I still use the default install setup of including head.inc and foot.inc the most to be honest (mostly through habit), but there are many ways to approach it as kongondo says.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...