This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Day 10 - Undefined variable: answer_pager in _answer.php

Discussion around this tutorial for symfony 1.0.x

Day 10 - Undefined variable: answer_pager in _answer.php

by dnovo » Fri Aug 01, 2008 9:51 pm

ubuntu 8.04
symfony 1.0

In the askeet tutorial in day 10 when it says:
Add the AJAX form
Change the end of the modules/question/templates/showSuccess.php template by:

Code: Select all
<div id="answers">
<?php foreach ($question->getAnswers() as $answer): ?>
  <div class="answer">
  <?php include_partial('answer/answer', array('answer' => $answer)) ?>
<?php endforeach; ?>

I have the error: Notice: Undefined variable: answer_pager in /home/sfprojects/askeet/apps/frontend/modules/answer/templat es/_answer.php on line 4

here's _answer.php:

Code: Select all
<?php use_helper('Text', 'Global', 'Date') ?>

<div id="answers">
<?php foreach ($answer_pager as $answer): ?>
  <div class="answer">
    <h2><?php echo link_to($answer->getQuestion()->getTitle(), 'question/show?stripped_title='.$answer->getQuestion()->getStrippedTitle()) ?></h2>
    <?php echo count($answer->getRelevancys()) ?> points
    posted by <?php echo link_to($answer->getUser(), 'user/show?id='.$answer->getUser()->getId()) ?>
    on <?php echo format_date($answer->getCreatedAt(), 'p') ?>
      <?php echo $answer->getBody() ?>
<?php endforeach ?>
<div id="question_pager">
  <?php echo pager_navigation($answer_pager, 'answer/recent') ?>

I followed the tutorial step by step
I did it twice and get the same result.

thanks for your help and sorry about my english
Junior Member
Posts: 3
Joined: Tue May 20, 2008 5:18 pm