ATutor

Learning Management Tools







Pages:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Im getting an error


  • 2007-07-06 14:16:19

    Im getting an error

    I'm trying to create a few custom pages in my mod with a php file having this format:

    <?php
    $_user_location = 'users';
    define('AT_INCLUDE_PATH', '../../include/');
    require (AT_INCLUDE_PATH.'vitals.inc.php');
    $_custom_css = $_base_path . 'mods/hello_world/module.css'; // use a custom stylesheet
    require (AT_INCLUDE_PATH.'header.inc.php');
    ?>

    <div id="mycontent">
    My content here
    </div>

    <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>

    This above file is called course_combo.php and a form on the index_mystart.php is being submitted to this php file. I'm being redirected to the index.php file with an error saying:
    The following errors occurred:

    * Page cannot be found.

    May I know what mistake I'm doing? I've read the module documentation but doesn't seem to get this right.

  • 2007-07-07 02:43:37

    Re: I'm getting an error

    And one more thing... I've tried the following in the index_mystart.php as a starting point to build up my mod but it doesn't seem to work. It keeps displaying the same page to me. What puzzles me is that there is an echo $sql; statement, but I don't see anything being echoed! May I know the possible explanation to this along with the answer for my previous post?

    [php]<?php
    $_user_location = 'users';
    define('AT_INCLUDE_PATH', '../../include/');
    require (AT_INCLUDE_PATH.'vitals.inc.php');
    $_custom_css = $_base_path . 'mods/hello_world/module.css'; // use a custom stylesheet

    ?>

    <!-- <div id="helloworld">
    This is a page of the Hello World module that requires a login session, but might contain a tool that is not a course tool :)
    </div> -->

    <?php
    if (isset($_POST['submit'])) {
    $sql = "SELECT * FROM ".TABLE_PREFIX."courses";
    echo $sql;
    $result = mysql_query($sql);
    while($row = mysql_fetch_assoc($result))
    if($_POST['$row[title]'])
    echo "Exists";

    /*if ($result = mysql_query($sql,$db)) {
    $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
    }else{
    $msg->addError('EC_COURSE_PAYMENT_SETTINGS_NOT_SAVED');
    }*/

    header('Location: '.$_SERVER['PHP_SELF']);
    exit;
    }
    ?>

    <?php
    require (AT_INCLUDE_PATH.'header.inc.php');
    //Get the various courses in the database into this page and then display them in a row with a checkbox
    //besides each record. ?>
    <div id="custom">
    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">


    <?php
    $sql = "SELECT * FROM ".TABLE_PREFIX."courses";
    $result = mysql_query($sql);
    while($row = mysql_fetch_assoc($result))
    echo "<input type='checkbox' name='".$row[title]."' value='".$row[course_id]."'/>"." ".$row[title]."<br>";
    ?>
    <div class="row buttons">
    <input type="submit" name="submit" value="<?php echo "Submit"; ?>" />
    </div>
    </form>
    </div>
    <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>[/php]

  • 2007-07-07 09:18:51

    Re: I'm getting an error

    You need to add the new page to the module's module.php file.

  • 2007-07-07 16:20:40

    Re: I'm getting an error

    Can you show me an example as to how to add it? Suppose that my file name is
    hope1.php - i want it to be available to only members
    hope2.php - Only instructors
    hope3.php - Only Admin

    How do I go about it? I have title and var there in the manage.php which I'm not able to understand...

  • 2007-07-07 16:30:22

    Re: I'm getting an error

    Use the hello world module as an example. Replace the file names in it with your file names.

    And see the module developer documentation.

  • 2007-07-07 16:46:38

    Re: I'm getting an error

    I am extremely sorry. I don't seem to be getting a hang of it. Believe me or not, I've designed the entire code for something but now I can't get it to run. Though I've added the filenames to module.php file it keeps redirecting me back to the original index.php of ATutor... I know I'm troubling you, but I'm unable to understand. One example from your side considering my above constraints would clear my doubts...

  • 2007-07-07 17:20:20

    Re: I'm getting an error

    If you study the source code of the module.php file, and read the comments it contains, and read the module developer documentation, at the links below, all the information you should need as a novice php programmer should be there.

    http://www.atutor.ca/development/documentation/modules.html
    http://atutorsvn.atrc.utoronto.ca/repos/atutor/trunk/docs/mods/hello_world/module.php

    You can hire us to build the module for you if you want to send us a full description of what you need. We don't have the resources to offer help learning basic php. Those skills you'll need to develop on your own.

  • 2007-07-07 17:37:19

    Re: I'm getting an error

    I completely understand the importance of your time. However, I must've tried hours trying to figure out what mistake I've been doing. Ok I'll try to come to the point:

    I have a file sample.php that contains:

    [php]<?php
    define('AT_INCLUDE_PATH', '../../include/');
    require (AT_INCLUDE_PATH.'vitals.inc.php');
    authenticate(AT_PRIV_HELLO_WORLD);
    require (AT_INCLUDE_PATH.'header.inc.php');
    ?>

    <div class="helloworld">
    This is a test message</div>

    <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>[/php]

    I've opened up module.php and added:
    $this->_pages['mods/hello_world/sample.php']['parent'] = AT_NAV_START;

    When i enter http://127.0.0.1/ATutor/mods/hello_world/sample.php to execute the script, I'm being redirected to this page: http://127.0.0.1/ATutor/users/index.php

    PS: I must've spent countless hours on this module - it might sound simple to you but then I'm still a beginner and it would bring me joy to make this work. I'm not willing to discard the entire mod just because I'm not getting how to execute it. Please Help me out...

  • 2007-07-07 17:46:40

    Re: I'm getting an error

    Alright, I understood the problem. I didn't add $_user_location = 'users'; in the sample.php file. But now, it displays a blank page... :( I wonder why I'm facing so many problems to get a simple thing to work...

  • 2007-07-07 18:01:20

    Re: I'm getting an error

    Alright... I got it :) There was this authenticate(AT_PRIV_HELLO_WORLD); statement in my file. I don't know where it came from. I'll read as to what this statement does. Sorry for the trouble. I'm still a novice so please pardon me for my ignorance...