views:

57

answers:

2

The error I'm trying to get rid of is there is an additional letter "t" outputted before the rest of the HTML in one of my Zend Framework applications. The "t" is there only in a single action so I'm certain the problem is somewhere there.

For illustration HTML markup of the buggy controller action starts like this:

t<!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" xml:lang="en" lang="en">
<head>

It's driving me crazy because I cannot find where this letter is being printed. Here is the entire action:

public function transactionsHistoryAction()
{
    $request = $this->getRequest();
    $transactions = $this->_getTable('Transactions');

    $finishedTransactions = $transactions->getSelect();
    $pendingWithdrawals = $transactions->getPendingWithDrawalsSelect();

    $paginator = Zend_Paginator::factory($finishedTransactions);
    $paginator->setCurrentPageNumber($request->getParam('p'));
    $paginator->setItemCountPerPage(20);

    $paginator2 = Zend_Paginator::factory($pendingWithdrawals);
    $paginator2->setCurrentPageNumber($request->getParam('p2'));
    $paginator2->setItemCountPerPage(20);

    $this->view->headTitle('Transactions - Administration panel - Website Name');
    $this->view->finishedTransactions = $paginator;
    $this->view->pendingWithdrawals = $paginator2;
}

And here is the only model I use in that action:

<?php
/**
 * transactions table
 *
 * @author Richard Knop
 */
class Transactions extends Zend_Db_Table_Abstract
{
    protected $_name = 'transactions';

    protected $_referenceMap = array(
        'User' => array(
            'columns' => array('user_id'),
            'refTableClass' => 'Users',
            'refColumns' => array('id')
        )
    );

    private function _getDb()
    {
        return Zend_Registry::get('dbAdapter');
    }

    public function getSelect()
    {
        $select = $this->select();
        $where = 'finished = 1';
        $select->where($where);
        $select->order('id DESC');
        return $select;
    }

    public function getPendingWithdrawalsSelect()
    {
        $select = $this->select();
        $where = "type = 'withdrawal' AND finished = 0";
        $select->where($where);
        $select->order('id DESC');
        return $select;
    }
}

Please help me :o

EDIT:

The layout is correct (the "t" is there only in this specific action, all other actions of the same controller output correct HTML without the "t").

+2  A: 

Sounds like you accidently typed a "t" somewhere in one of your PHP files (outside of ). Would really be near impossible for us to find without seeing all the files. You'll be looking for something like:

t<?php

class MyModel 
{
}
Typeoneerror
+3  A: 

As TypeONeError said it is a typo in one of your php files. A quick way to find this is to do a recursive file search (find in files in your editor). Look for

"t<?" or "?>t"
Byron Whitlock
Thanks I found it with NetBeans search feature :)
Richard Knop
and by impossible, I mean "very easy"...lol nice one Byron.
Typeoneerror
Just a little note to help cut down on this problem. In php files that end in `?>` (ie. PHP only files) you can leave off the ending `?>`.
MitMaro
Yes I don't end my php files with ?> so I just searched for t<?
Richard Knop