Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
HELP -- Messaging Tutorial - have you tried it?
  • I was working on this tutorial
    http://fuelphp.com/forums/topics/view/3228 but at the end of where you code the part that takes in comments for messages posted, I get this error

    ErrorException [ Notice ]: Undefined variable: message
    APPPATH/views/comments/create.php @ line 3:
    2: <?php echo render('comments/_form'); ?>
    3: <p><?php echo Html::anchor('messages/view/'.$message, 'Back'); ?></p>

    what went wrong?
    i simply copy/pasted it all
  • What specific tutorial? There are lots in that thread. Note that quite a few of those were written for v1.1, so they might not be compatible with 1.2.
  • Hi, The tutorial Im referring to is http://ucf.github.com/fuelphp-crash-course/ Looks like the error is in the syntax. Can anyone spot it? Thanks for your reply, I really want to get into fuel. PS: btw, do you (or anyone else) know of any tutorial that uses the current version? Although i really like the above tutorial. Very complete.
  • Look for the code that loads the 'comments/create' view. This errors means there is no variable called 'message' passed to the view. Go through the code to see where 'message' is set (or not) and how it's used. From what i can see on that the tutorial page is that it does a set_global() of the 'message' variable in case nothing is posted, but I don't see it being set after a post.
  • Hi, here is the views =====================================
    <?php echo Form::open(); ?>
    <p>
    <?php echo Form::label('Name', 'name'); ?>
    <?php echo Form::input('name', Input::post('name', isset($comment) ? $comment->name : '')); ?>
    </p>
    <p>
    <?php echo Form::label('Comment', 'comment'); ?>
    <?php echo Form::textarea('comment', Input::post('comment', isset($comment) ? $comment->comment : ''), array('cols' => 60, 'rows' => 8)); ?>
    </p>
    <?php echo Form::hidden('mid', Input::post('mid', isset($message) ? $message : '')); ?>
    <div class="actions">
    <?php echo Form::submit(); ?> </div>
    <?php echo Form::close(); ?>
    ========================================= can you help me?
  • I wasn't referring to the view, but to the controller (or controllers) that load the view. One of the controller methods isn't passing a $message variable to the view, which causes the notice. This by the way looks like the _form.php file, containing the generated form.
  • Hi to everyone,

    especially if you are experiencing the above mentioned problem.
    The solution is simple: just continue with the tutorial, everything will work fine after finishing the step Adding to the Database.

    Good tutorial apart from that.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion