Page Views

Click on links to change page view


PHP/HTML Source:
<?php

require_once("raxan/pdi/autostart.php"); 

class MyPage extends RaxanWebPage {

    protected function _config() {
        $this->masterTemplate = 'views/master.homepage.html';
    }

    // -- View handlers

    protected function _indexView() {
        $this->appendView('pageview.welcome.html');
    }

    protected function _helpView() {
        $this->appendView('pageview.help.html');
    }

    protected function _thankyouView() {
        $this->appendView('pageview.thankyou.html');
    }

    protected function _signupView() {
        $this->appendView('pageview.signup-form.html');
        $this->preserveFormContent = true;
    }

    protected function _switcherView() {
        // redirect to the help view
        $this->redirectToView('help');
    }

    // -- Event handlers

    protected function signup($e){
        $name = $this->post->textVal('name');
        // we're in ajax mode so let's use the C() function
        if (!$name) $this->flashmsg('Sign up Error. Please enter a name.','fade','rax-box error');
        else $this->redirectToView ('thankyou'); // redirect to the thankyou view
    }

}


?>

<div class="container append-bottom">
    <h3>Links</h3>
    <div class="pad round border2">
       <a href="pageview.php">Home</a>
     | <a href="pageview.php?vu=signup">Sign Up</a>
     | <a href="pageview.php?vu=switcher">Switch To Help...</a>
    </div>
</div>



Plugin Source:

HTML/JavaScript Source (views/pageview.signup-form.html):
<style type="text/css">
    label { display:block; float:left;width:120px }
</style>
<div class="container c35">
    <h2>Sign up</h2>
    <form id="form1" class="c20" method="post">
        <fieldset>
            <legend>Sign up form</legend>
                <div class="flashmsg bmm"></div>
                <div class="ctrl-group">
                    <label>User name:</label><input type="text" name="name" class="textbox c10" />
                </div>
                <div class="ctrl-group">
                    <label>Password:</label><input type="password" name="password" class="textbox c10" />
                </div>
                <div class="ctrl-group">
                    <label>Retype Password:</label><input type="password" name="cpassword" class="textbox c10" />
                </div>
                <div class="ctrl-group">
                    <label>Email:</label><input type="text" name="email" class="textbox c10" />
                </div>
                <div class="ctrl-group">
                    <label>Website:</label><input type="text" name="website" class="textbox c10" />
                </div>
                <hr />
                <input type="submit" value="Submit" xt-bind="click,signup"/>
        </fieldset>
    </form>
</div>

Data Source: