System messages on custom index

Hi all,

I'm trying to replace the custom index with an index.php which doesn't use the page_draw() function because I would like to create a full screen HTML page and not be limited by the canvas_layout. I have a working example but it has some hickups. It doesn't show the system messages on logout and they are shown when I log in again or look at any other Elgg page (I know it saves the system messages in a $SESSION). What code needs to be inserted so that system messages are displayed on the index page?I tried creating a system messages div and including all the jquery but that didn't work. Here is some basic code of what I was thinking of. Any tips?

Regards,

Matthijs

<?php

    /**
     * Elgg custom index
     *
     */
    global $CONFIG;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;

<head profile="http://gmpg.org/xfn/11"&gt;
    <title>Title here</title>   
    <link rel="stylesheet" href="<?php echo $CONFIG->wwwroot ?>mod/my_theme/views/default/my_theme/my_style.css" type="text/css" />
      <script src="<?php echo $CONFIG->wwwroot ?>mod/my_theme/vendors/jquery/jquery.js" type="text/javascript"></script>
</head>

</body>
<div id="custom_index_topnav"> Have an account? <a href="login.html" class="signin"><span>Sign in</span></a></div>
<fieldset id="signin_menu">
<form action="<?php echo elgg_add_action_tokens_to_url('/action/login') ?>" method="post" >
    <p>
        <label>Username<br /><input type="text"   name="username"  value="" class="login-textarea"/></label><br />
        <label>Password<br /><input type="password"   name="password"  value="" class="login-textarea" /></label><br />
        <input name=""  type="submit" class="submit_button"  value="Log in"  />
    </p>
        <p>
        <a href="<?php echo $CONFIG->wwwroot ?>/account/register.php">Register</a>
        </p>
</form>
</fieldset>

<script type="text/javascript">
        $(document).ready(function() {

            $(".signin").click(function(e) {         
                e.preventDefault();
                $("fieldset#signin_menu").toggle();
                $(".signin").toggleClass("menu-open");
            });
           
            $("fieldset#signin_menu").mouseup(function() {
                return false
            });
            $(document).mouseup(function(e) {
                if($(e.target).parent("a.signin").length==0) {
                    $(".signin").removeClass("menu-open");
                    $("fieldset#signin_menu").hide();
                }
            });           
           
        });
</script>

<div id="index_header">
        <ul>
            <li><a href="#">Link1</a></li>
            <li><a href="#">Link2</a></li>
            <li><a href="#">Link3</a></li>
        </ul>   
    </div>
    <div id="index_content">
        <div id="index_main">
            <h1>Welcome To my custom index</h1>
        </div>
    </div>
    <div id="index_footer">
        <p>My footer</p>
    </div>
</body>
</div>
</html>

  • Juipo

    You are correct, custom index only displays after layout_canvas div.

    The way I've done this for a client before is little different and it's not very clear what you have done here but you might try to add require_once engine/start.php.

  • You can either override the css by adding the css snippet to your index page itself or as juipo mentioned you can include the elgg engine to any html page.

  • How about a cheaters way?

    View source, copy all, paste in your favorite html editor, make your changes to the index and upload. 

  • If I'd do it the cheaters way wouldn't I just be copying the generated message? It would also then show me "you have been logged out" when a user comes to the page for the first time. I tried to include the engine/start.php but i keep getting the WSOD. I must be making a php mistake.

    About the include of start.php. Since it is in my theme plugin could this really make a difference? I tried to include it after your suggestions and I keep getting the WSOD so I must be making a php mistake somewhere but just wondering if it would be the solution.

     

  • Ahh, figured it out. What works is actually a combination of what you both have written.
    I take the css and javascript from the view source and because the engine was already started you can call the system_messages() function. Then loop through them and display them. This function also empties the system messages from the session. Thanks for the tips you guys!