Parse error when customizing "View Issues"

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
NickDeGraeve
Posts: 8
Joined: 03 Jul 2007, 08:45
Location: Hamme, Belgium

Parse error when customizing "View Issues"

Post by NickDeGraeve »

I want to add a couple of columns of custom fields to the " View Issues" page. I created the file custom_functions_inc.php in $MANTIS_HOME/ and added this code to it:

Code: Select all

<?php>
    function custom_function_override_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
        $t_columns = array();

        if ( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) {
            $t_columns[] = 'id'; // localized: 'id',
            $t_columns[] = 'project_id'; // 'email_project'
            $t_columns[] = 'reporter_id'; // 'reporter'
            $t_columns[] = 'handler_id'; // 'assigned_to'
            $t_columns[] = 'priority'; // 'priority'
            $t_columns[] = 'severity'; // 'severity'
            $t_columns[] = 'reproducibility'; // 'reproducibility'
            $t_columns[] = 'version'; // 'version'
            $t_columns[] = 'projection'; // 'projection'
            $t_columns[] = 'category'; // 'category'
            $t_columns[] = 'date_submitted'; // 'date_submitted'
            $t_columns[] = 'eta'; // 'eta'
            $t_columns[] = 'os'; // 'os'
            $t_columns[] = 'os_build'; // 'os_version'
            $t_columns[] = 'platform'; // 'platform'
            $t_columns[] = 'view_state'; // 'view_status'
            $t_columns[] = 'last_updated'; // 'last_update'
            $t_columns[] = 'summary'; // 'summary'
            $t_columns[] = 'status'; // 'status'
            $t_columns[] = 'resolution'; // 'resolution'
            $t_columns[] = 'fixed_in_version'; // 'fixed_in_version';
            if ( OFF == config_get( 'enable_relationship' ) ) {
                $t_columns[] = 'duplicate_id'; // 'duplicate_id'
            }
        } else {
            $t_columns[] = 'selection';
            if ( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) {
                $t_columns[] = 'edit';
            }
            $t_columns[] = 'id';
            $t_enable_sponsorship = config_get( 'enable_sponsorship' );
            if ( ON == $t_enable_sponsorship ) {
                $t_columns[] = 'sponsorship_total';
            }
            $t_columns[] = 'bugnotes_count';
            $t_show_attachments = config_get( 'show_attachment_indicator' );
            if ( ON == $t_show_attachments ) {
                $t_columns[] = 'attachment';
            }
            $t_columns[] = 'category';
            $t_columns[] = 'severity';
            $t_columns[] = 'status';
            $t_columns[] = 'last_updated';

            $t_columns[] = 'custom_application';
            $t_columns[] = 'custom_component';
            $t_columns[] = 'custom_plugin';
            $t_columns[] = 'custom_investigation_time';
            $t_columns[] = 'custom_estimated_time';
            $t_columns[] = 'custom_resolution_time';

            $t_columns[] = 'summary';
        }
        return $t_columns;
    }
<?>
but I get this error:

Code: Select all

Parse error: syntax error, unexpected T_FUNCTION in /opt/mantis-1.0.6/custom_functions_inc.php on line 2
What am I doing wrong?
leblancma
Posts: 37
Joined: 09 Jan 2006, 15:22
Location: Canada
Contact:

Re: Parse error when customizing "View Issues"

Post by leblancma »

NickDeGraeve wrote:<?php>
===
=== SNIPPED
===
return $t_columns;
}
<?>
Try this

Code: Select all

<?php

====

?>
Also, do not add any spaces outside the php block.

Hope this works.

Regards,

Maurice
NickDeGraeve
Posts: 8
Joined: 03 Jul 2007, 08:45
Location: Hamme, Belgium

Post by NickDeGraeve »

Doh! How silly. Thanks. I'm totally not familiar with PHP. That's probably why I missed such a easy to spot error.
leblancma
Posts: 37
Joined: 09 Jan 2006, 15:22
Location: Canada
Contact:

Post by leblancma »

NickDeGraeve wrote:Doh! How silly. Thanks. I'm totally not familiar with PHP. That's probably why I missed such a easy to spot error.
Nick,

You may wish to consult the W3Schools web site at http://w3schools.com/

PHP is under "Server Scripting" in the sidebar menu.

Regards,

Maurice
Post Reply