Jump to content

Need to display form field output in table format


Go to solution Solved by judah,

Recommended Posts

Hi there, oh pretty please can someone assist. I'm rapidly running out of time and cannot seem to get this to work for me.

 

I have a content submission form and need the the output to display in a table format, so I'm adding this to the template php.... (Using Cobalt CMS on Joomla). My previous (Cobalt 7) templates worked fine with me adding the table as follows:

 

<table id='display' width=548 border=0 summary="">
    <tr>
        <td rowspan=7><?php echo $item->fields_by_id[3]->result; ?></td>
        <td width=100><b>Author:</b></td>
        <td width=220><?php echo $item->fields_by_id[1]->result; ?></td>
    </tr>
    <tr>
        <td width=100><b>Publisher:</b></td>
        <td width=220><?php echo $item->fields_by_id[2]->result; ?></td>
    </tr>
    <tr>
        <td width=100><b>Genre:</b></td>
        <td width=220><?php echo $item->fields_by_id[9]->result; ?></td>
    </tr>
    <tr>
        <td width=100><b>CRR Heat Rating:</b></td>
        <td width=220><?php echo $item->fields_by_id[11]->result; ?></td>
    </tr>
    <tr>
        <td colspan=2><?php echo $this->ifields['Buy Amazon']; ?>
</td>
    </tr>
    <tr>
        <td colspan=2><?php echo $this->ifields['Buy BandN']; ?>
</td>
    </tr>
    <tr>
        <td colspan=2><?php echo $this->ifields['Buy Smashwords']; ?>
</td>
    </tr>
    <tr>
        <td colspan=3><?php echo $item->fields_by_id[4]->result; ?></td>
    </tr>
    <tr>
        <td colspan=3><?php echo $this->ifields['CRR Review']; ?></td>
    </tr>
</table>

 

 

I now get the following error:  Parse error: syntax error, unexpected '<' in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 695

 

I've traced this to the <table   as above.  I have looked on the web and found various examples where the table is included within the <?php  ?>  but cannot seem to find one that includes the php echo within the table.

 

I've also tried adding the echo '<table> </table>'  but that seemed to make it worse.

 

I would really appreciate assistance with this. I know my ignorance is my greatest limitation and am trying to learn as I go along, but this silly little something has me totally flummoxed and I'm now b**** to the wall trying to get this finished to go live on Sunday.

 

I shall grovel in abject gratitude....

 

Thank you,

Jude

 

 

The block of code you have posted is valid html/php code. There are no errors on its own

 

Its most like how you're implementing that code in your scripts. To get that error you're most likely just dumping it into the <?php ?> tags. like

<?php

<table>
...
</table>

?>

You cannot just dump html code inside PHP tags. PHP cannot parse html code. You need to either echo it out. Or go in and out of PHP mode. Example

<?php
//your php code here

// no break out of php mode and display table
?>
<table>
...
</table>
<?php
// break into php mode again

?>

 

 
<?php

/**

 * Cobalt by MintJoomla

 * a component for Joomla! 1.7 - 2.5 CMS (http://www.joomla.org)

 * Author Website: http://www.mintjoomla.com/

 * @copyright Copyright (C) 2012 MintJoomla (http://www.mintjoomla.com). All rights reserved.

 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html

 */



defined('_JEXEC') or die();



$item = $this->item;

$params = $this->tmpl_params['record'];

$icons = array();

$category = array();

$author = array();

$details = array();

$started = FALSE;

$i = $o = 0;



?>

<style>

    .dl-horizontal dd {

        margin-bottom: 10px;

    }



.tag_list li {

    display: block;

    float:left;

    list-style-type: none;

    margin-right: 5px;

}

.tag_list li#tag-first {

    line-height: 30px;

}

.tag_list li * {

    margin: 0px;

    padding: 0px;

    line-height: 30px;

}



.tag_list li a {

    color: #000;

    text-decoration: none;

    border: 1px solid #445D83;

    background-color: #F2F8FF;

    border-radius: 8px;

    padding: 5px 10px 5px 10px;

}



.tag_list li a:HOVER {

    color: #000;

    text-decoration: underline;

}

.line-brk {

    margin-left: 0px !important;

}

<?php echo $params->get('tmpl_params.css');?>

</style>



<?php

if($params->get('tmpl_core.item_categories') && $item->categories_links)

{

    $category[] = sprintf('<dt>%s<dt> <dd>%s<dd>', (count($item->categories_links) > 1 ? JText::_('CCATEGORIES') : JText::_('CCATEGORY')), implode(', ', $item->categories_links));

}

if($params->get('tmpl_core.item_user_categories') && $item->ucatid)

{

    $category[] = sprintf('<dt>%s<dt> <dd>%s<dd>', JText::_('CUCAT'), $item->ucatname_link);

}

if($params->get('tmpl_core.item_author') && $item->user_id)

{

    $a[] = JText::sprintf('CWRITTENBY', CCommunityHelper::getName($item->user_id, $this->section));

    if($params->get('tmpl_core.item_author_filter'))

    {

        $a[] = FilterHelper::filterButton('filter_user', $item->user_id, NULL, JText::sprintf('CSHOWALLUSERREC', CCommunityHelper::getName($item->user_id, $this->section, array('nohtml' => 1))), $this->section);

    }

    $author[] = implode(' ', $a);

}

if($params->get('tmpl_core.item_ctime'))

{

    $author[] = JText::sprintf('CONDATE', JHtml::_('date', $item->created, $params->get('tmpl_core.item_time_format')));

}



if($params->get('tmpl_core.item_mtime'))

{

    $author[] = JText::_('CMTIME').': '.JHtml::_('date', $item->modify, $params->get('tmpl_core.item_time_format'));

}

if($params->get('tmpl_core.item_extime'))

{

    $author[] = JText::_('CEXTIME').': '.($item->expire ? JHtml::_('date', $item->expire, $params->get('tmpl_core.item_time_format')) : JText::_('CNEVER'));

}



if($params->get('tmpl_core.item_type'))

{

    $details[] = sprintf('%s: %s %s', JText::_('CTYPE'), $this->type->name, ($params->get('tmpl_core.item_type_filter') ? FilterHelper::filterButton('filter_type', $item->type_id, NULL, JText::sprintf('CSHOWALLTYPEREC', $this->type->name), $this->section) : NULL));

}

if($params->get('tmpl_core.item_hits'))

{

    $details[] = sprintf('%s: %s', JText::_('CHITS'), $item->hits);

}

if($params->get('tmpl_core.item_comments_num'))

{

    $details[] = sprintf('%s: %s', JText::_('CCOMMENTS'), CommentHelper::numComments($this->type, $this->item));

}

if($params->get('tmpl_core.item_favorite_num'))

{

    $details[] = sprintf('%s: %s', JText::_('CFAVORITED'), $item->favorite_num);

}

if($params->get('tmpl_core.item_follow_num'))

{

    $details[] = sprintf('%s: %s', JText::_('CFOLLOWERS'), $item->subscriptions_num);

}

?>



<article class="<?php echo $this->appParams->get('pageclass_sfx')?><?php if($item->featured) echo ' article-featured' ?>">

    <?php if(!$this->print):?>

        <div class="pull-right controls">

            <div class="btn-group">

                <?php if($params->get('tmpl_core.item_print')):?>

                    <a class="btn btn-mini" onclick="window.open('<?php echo JRoute::_($this->item->url.'&tmpl=component&print=1');?>','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'); return false;">

                        <?php echo HTMLFormatHelper::icon('printer.png', JText::_('CPRINT'));  ?></a>

                <?php endif;?>



                <?php if($this->user->get('id')):?>

                    <?php echo HTMLFormatHelper::bookmark($item, $this->type, $params);?>

                    <?php echo HTMLFormatHelper::follow($item, $this->section);?>

                    <?php echo HTMLFormatHelper::repost($item, $this->section);?>

                    <?php if($item->controls):?>

                        <a href="#" data-toggle="dropdown" class="dropdown-toggle btn btn-mini">

                            <?php echo HTMLFormatHelper::icon('gear.png');  ?></a>

                        <ul class="dropdown-menu">

                            <?php echo list_controls($item->controls);?>

                        </ul>

                    <?php endif;?>

                <?php endif;?>

            </div>

        </div>

    <?php else:?>

        <div class="pull-right controls">

            <a href="#" class="btn btn-mini" onclick="window.print();return false;"><?php echo HTMLFormatHelper::icon('printer.png', JText::_('CPRINT'));  ?></a>

        </div>

    <?php endif;?>

    <?php if($params->get('tmpl_core.item_title')):?>

        <?php if($this->type->params->get('properties.item_title')):?>

            <div class="page-header">

                <<?php echo $params->get('tmpl_params.title_tag', 'h1')?>>

                    <?php echo $item->title?>

                    <?php echo CEventsHelper::showNum('record', $item->id);?>

                </<?php echo $params->get('tmpl_params.title_tag', 'h1')?>>

            </div>

        <?php endif;?>

    <?php endif;?>

    <div class="clearfix"></div>



    <?php if(isset($this->item->fields_by_groups[null])):?>

        <dl class="dl-horizontal fields-list">

            <?php foreach ($this->item->fields_by_groups[null] as $field_id => $field):?>

                <dt id="<?php echo 'dt-'.$field_id; ?>" class="<?php echo $field->fieldclass;?>">

                    <?php if($field->params->get('core.show_lable') > 1):?>

                        <label id="<?php echo $field->id;?>-lbl">

                            <?php echo $field->label; ?>

                            <?php if($field->params->get('core.icon')):?>

                                <?php echo HTMLFormatHelper::icon($field->params->get('core.icon'));  ?>

                            <?php endif;?>

                        </label>

                        <?php if($field->params->get('core.label_break') > 1):?>

                        <?php endif;?>

                    <?php endif;?>

                </dt>

                <dd id="<?php echo 'dd-'.$field_id; ?>" class="<?php echo $field->fieldclass;?><?php echo ($field->params->get('core.label_break') > 1 ? ' line-brk' : NULL) ?>">

                    <?php echo $field->result; ?>

                </dd>

            <?php endforeach;?>

        </dl>

        <?php unset($this->item->fields_by_groups[null]);?>

    <?php endif;?>



    <?php if(in_array($params->get('tmpl_params.item_grouping_type', 0), array(1)) && count($this->item->fields_by_groups)):?>

    <div class="clearfix"></div>

    <div class="tabbable <?php echo $params->get('tmpl_params.tabs_position');  ?>">

        <ul class="nav <?php echo $params->get('tmpl_params.tabs_style', 'nav-tabs');  ?>" id="tabs-list">

            <?php if(isset($this->item->fields_by_groups)):?>

                <?php foreach ($this->item->fields_by_groups as $group_id => $fields) :?>

                    <li><a href="#tab-<?php echo $o++?>" data-toggle="tab"> <?php echo HTMLFormatHelper::icon($item->field_groups[$group_id]['icon'])?> <?php echo JText::_($group_id)?></a></li>

                <?php endforeach;?>

            <?php endif;?>

        </ul>

    <?php endif;?>



    <?php if(isset($this->item->fields_by_groups)):?>

        <?php foreach ($this->item->fields_by_groups as $group_name => $fields) :?>



            <?php $started = true;?>

            <?php group_start($this, $group_name, 'tab-'.$i++);?>

            <dl class="dl-horizontal fields-list fields-group<?php echo $i;?>">

                <?php foreach ($fields as $field_id => $field):?>

                    <dt id="<?php echo 'dt-'.$field_id; ?>" class="<?php echo $field->fieldclass;?>">

                        <?php if($field->params->get('core.show_lable') > 1):?>

                            <label id="<?php echo $field->id;?>-lbl">

                                <?php echo $field->label; ?>

                                <?php if($field->params->get('core.icon')):?>

                                    <?php echo HTMLFormatHelper::icon($field->params->get('core.icon'));  ?>

                                <?php endif;?>

                            </label>

                            <?php if($field->params->get('core.label_break') > 1):?>

                            <?php endif;?>

                        <?php endif;?>

                    </dt>

                    <dd id="<?php echo 'dd-'.$field_id; ?>" class="<?php echo $field->fieldclass;?><?php echo ($field->params->get('core.label_break') > 1 ? ' line-brk' : NULL) ?>">

                        <?php echo $field->result; ?>

                    </dd>

                <?php endforeach;?>

            </dl>

            <?php group_end($this);?>

        <?php endforeach;?>

    <?php endif;?>



    <?php if($started):?>

        <?php total_end($this);?>

    <?php endif;?>

    <?php if(in_array($params->get('tmpl_params.item_grouping_type', 0), array(1))  && count($this->item->fields_by_groups)):?>

        </div>

        <div class="clearfix"></div>

        <br />

    <?php endif;?>



    <?php echo $this->loadTemplate('tags');?>



    <?php if($category || $author || $details || $params->get('tmpl_core.item_rating')): ?>

        <div class="well article-info">

            <div class="row-fluid">

                <?php if($params->get('tmpl_core.item_rating')):?>

                    <div class="span2">

                        <?php echo $item->rating;?>

                    </div>

                <?php endif;?>

                <div class="span<?php echo ($params->get('tmpl_core.item_rating') ? 8 : 10);?>">

                    <small>

                        <dl class="dl-horizontal user-info">

                            <?php if($category):?>

                                <?php echo implode(' ', $category);?>

                            <?php endif;?>

                            <?php if($author):?>

                                <dt><?php echo JText::_('Posted');?></dt>

                                <dd>

                                    <?php echo implode(', ', $author);?>

                                </dd>

                            <?php endif;?>

                            <?php if($details):?>

                                <dt>Info</dt>

                                <dd class="hits">

                                    <?php echo implode(', ', $details);?>

                                </dd>

                            <?php endif;?>

                        </dl>

                    </small>

                </div>

                <?php if($params->get('tmpl_core.item_author_avatar')):?>

                    <div class="span2 avatar">

                        <img src="<?php echo CCommunityHelper::getAvatar($item->user_id, $params->get('tmpl_core.item_author_avatar_width', 40), $params->get('tmpl_core.item_author_avatar_height', 40));?>" />

                    </div>

                <?php endif;?>

            </div>

        </div>

    <?php endif;?>

</article>



<?php if($started):?>

    <script type="text/javascript">

        <?php if(in_array($params->get('tmpl_params.item_grouping_type', 0), array(1))):?>

            jQuery('#tabs-list a:first').tab('show');

        <?php elseif(in_array($params->get('tmpl_params.item_grouping_type', 0), array(2))):?>

            jQuery('#tab-main').collapse('show');

        <?php endif;?>

    </script>

<?php endif;?>













<?php

function group_start($data, $label, $name)

{

    static $start = false;

    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))

    {

        //tab

        case 1:

            if(!$start)

            {

                echo '<div class="tab-content" id="tabs-box">';

                $start = TRUE;

            }

            echo '<div class="tab-pane" id="'.$name.'">';

            break;

        //slider

        case 2:

            if(!$start)

            {

                echo '<div class="accordion" id="accordion2">';

                $start = TRUE;

            }

            echo '<div class="accordion-group">

                <div class="accordion-heading">

                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#'.$name.'">

                         '.$label.'

                    </a>

                </div>

                <div id="'.$name.'" class="accordion-body collapse">

                    <div class="accordion-inner">';

            break;

        // fieldset

        case 3:

            echo "<legend>{$label}</legend>";

        break;

    }

}



function group_end($data)

{

    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))

    {

        case 1:

            echo '</div>';

        break;

        case 2:

            echo '</div></div></div>';

        break;

    }

}



function total_end($data)

{

    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))

    {

        //tab

        case 1:

            echo '</div>';

        break;

        case 2:

            echo '</div>';

        break;

    }

}



    <?php echo <table id='display' width=548 border=0 summary="">?>
    <tr>
        <td rowspan=7><?php echo $item->fields_by_id[3]->result; ?></td>
        <td width=100><b>Author:</b></td>
        <td width=220><?php echo $item->fields_by_id[1]->result; ?></td>
    </tr>
    <tr>
        <td width=100><b>Publisher:</b></td>
        <td width=220><?php echo $item->fields_by_id[2]->result; ?></td>
    </tr>
    <tr>
        <td width=100><b>Genre:</b></td>
        <td width=220><?php echo $item->fields_by_id[9]->result; ?></td>
    </tr>
    <tr>
        <td width=100><b>CRR Heat Rating:</b></td>
        <td width=220><?php echo $item->fields_by_id[11]->result; ?></td>
    </tr>
    <tr>
        <td colspan=2><?php echo $this->ifields['Buy Amazon']; ?>
</td>
    </tr>
    <tr>
        <td colspan=2><?php echo $this->ifields['Buy BandN']; ?>
</td>
    </tr>
    <tr>
        <td colspan=2><?php echo $this->ifields['Buy Smashwords']; ?>
</td>
    </tr>
    <tr>
        <td colspan=3><?php echo $item->fields_by_id[4]->result; ?></td>
    </tr>
    <tr>
        <td colspan=3><?php echo $this->ifields['CRR Review']; ?></td>
    </tr>
</table>

    <?php echo $this->loadTemplate('tags');?>    <?php if($category || $author || $details || $params->get('tmpl_core.item_rating')): ?>        <div class="well article-info">            <div class="row-fluid">                <?php if($params->get('tmpl_core.item_rating')):?>                    <div class="span2">                        <?php echo $item->rating;?>                    </div>                <?php endif;?>                <div class="span<?php echo ($params->get('tmpl_core.item_rating') ? 8 : 10);?>">                    <small>                        <dl class="dl-horizontal user-info">                            <?php if($category):?>                                <?php echo implode(' ', $category);?>                            <?php endif;?>                            <?php if($author):?>                                <dt><?php echo JText::_('Posted');?></dt>                                <dd>                                    <?php echo implode(', ', $author);?>                                </dd>                            <?php endif;?>                            <?php if($details):?>                                <dt>Info</dt>                                <dd class="hits">                                    <?php echo implode(', ', $details);?>                                </dd>                            <?php endif;?>                        </dl>                    </small>                </div>                <?php if($params->get('tmpl_core.item_author_avatar')):?>                    <div class="span2 avatar">                        <img src="<?php echo CCommunityHelper::getAvatar($item->user_id, $params->get('tmpl_core.item_author_avatar_width', 40), $params->get('tmpl_core.item_author_avatar_height', 40));?>" />                    </div>                <?php endif;?>            </div>        </div>    <?php endif;?></article><?php if($started):?>    <script type="text/javascript">        <?php if(in_array($params->get('tmpl_params.item_grouping_type', 0), array(1))):?>            jQuery('#tabs-list a:first').tab('show');        <?php elseif(in_array($params->get('tmpl_params.item_grouping_type', 0), array(2))):?>            jQuery('#tab-main').collapse('show');        <?php endif;?>    </script><?php endif;?><?phpfunction group_start($data, $label, $name){    static $start = false;    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))    {        //tab        case 1:            if(!$start)            {                echo '<div class="tab-content" id="tabs-box">';                $start = TRUE;            }            echo '<div class="tab-pane" id="'.$name.'">';            break;        //slider        case 2:            if(!$start)            {                echo '<div class="accordion" id="accordion2">';                $start = TRUE;            }            echo '<div class="accordion-group">                <div class="accordion-heading">                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#'.$name.'">                         '.$label.'                    </a>                </div>                <div id="'.$name.'" class="accordion-body collapse">                    <div class="accordion-inner">';            break;        // fieldset        case 3:            echo "<legend>{$label}</legend>";        break;    }}function group_end($data){    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))    {        case 1:            echo '</div>';        break;        case 2:            echo '</div></div></div>';        break;    }}function total_end($data){    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))    {        //tab        case 1:            echo '</div>';        break;        case 2:            echo '</div>';        break;    }}

 

Thank you.

You didn't close PHP here:

        case 2:
 
            echo '</div>';
 
        break;
 
    }
 
}
 
 
 
    <?php echo <table id='display' width=548 border=0 summary="">?>
 
Try: 
        case 2:
 
            echo '</div>';
 
        break;
 
    }
 
}
?>
 
 
    <table id='display' width=548 border=0 summary="">

 

this  is not right

<?php echo <table id='display' width=548 border=0 summary="">?>

It should be

?>

<table id='display' width=548 border=0 summary="">

Your code is messy and hard to read, but thats probably the forum.

Edited by Ch0cu3r

Also, there appears to be an error here:

    <?php echo $this->loadTemplate('tags');?>    <?php if($category || $author || $details || $params->get('tmpl_core.item_rating')): ?>        <div class="well article-info">            <div class="row-fluid">                <?php if($params->get('tmpl_core.item_rating')):?>                    <div class="span2">                        <?php echo $item->rating;?>                    </div>                <?php endif;?>                <div class="span<?php echo ($params->get('tmpl_core.item_rating') ? 8 : 10);?>">                    <small>                        <dl class="dl-horizontal user-info">                            <?php if($category):?>                                <?php echo implode(' ', $category);?>                            <?php endif;?>                            <?php if($author):?>                                <dt><?php echo JText::_('Posted');?></dt>                                <dd>                                    <?php echo implode(', ', $author);?>                                </dd>                            <?php endif;?>                            <?php if($details):?>                                <dt>Info</dt>                                <dd class="hits">                                    <?php echo implode(', ', $details);?>                                </dd>                            <?php endif;?>                        </dl>                    </small>                </div>                <?php if($params->get('tmpl_core.item_author_avatar')):?>                    <div class="span2 avatar">                        <img src="<?php echo CCommunityHelper::getAvatar($item->user_id, $params->get('tmpl_core.item_author_avatar_width', 40), $params->get('tmpl_core.item_author_avatar_height', 40));?>" />                    </div>                <?php endif;?>            </div>        </div>    <?php endif;?></article><?php if($started):?>    <script type="text/javascript">        <?php if(in_array($params->get('tmpl_params.item_grouping_type', 0), array(1))):?>            jQuery('#tabs-list a:first').tab('show');        <?php elseif(in_array($params->get('tmpl_params.item_grouping_type', 0), array(2))):?>            jQuery('#tab-main').collapse('show');        <?php endif;?>    </script><?php endif;?><?phpfunction group_start($data, $label, $name){    static $start = false;    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))    {        //tab        case 1:            if(!$start)            {                echo '<div class="tab-content" id="tabs-box">';                $start = TRUE;            }            echo '<div class="tab-pane" id="'.$name.'">';            break;        //slider        case 2:            if(!$start)            {                echo '<div class="accordion" id="accordion2">';                $start = TRUE;            }            echo '<div class="accordion-group">                <div class="accordion-heading">                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#'.$name.'">                         '.$label.'                    </a>                </div>                <div id="'.$name.'" class="accordion-body collapse">                    <div class="accordion-inner">';            break;        // fieldset        case 3:            echo "<legend>{$label}</legend>";        break;    }}function group_end($data){    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))    {        case 1:            echo '</div>';        break;        case 2:            echo '</div></div></div>';        break;    }}function total_end($data){    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))    {        //tab        case 1:            echo '</div>';        break;        case 2:            echo '</div>';        break;    }}

However, I don't plan to wade through the code since it's on one giant line.  :happy-04:

Actually, the error looks to be caused by starting a comment in the middle of the code.

get('tmpl_params.item_grouping_type', 0))    {        //tab        case

Since it's one giant line of code, everything after the comment is ignored.

Thank you for trying, I appreciate it. I have asked one of the fellows on the cobalt forum to spare me a moment and look, perhaps he will find something.

 

Just in case the solutions got buried, did you see

Those should hopefully take care of the issues.

 

Sorry for the overabundance of posts.  :happy-04:

I've done the correction as per #7, but but now get error:

 

Parse error: syntax error, unexpected '<' in /home/classicr/public_html/components/com_cobalt/views/record/tmpl/default_record_library.php on line 639

 

It does have to do with the "chunk" of code. I have gone back to the original default template and copied this code (which I have not changed at all) as follows:

 

 

 

<?php echo $this->loadTemplate('tags');?>



    <?php if($category || $author || $details || $params->get('tmpl_core.item_rating')): ?>

        <div class="well article-info">

            <div class="row-fluid">

                <?php if($params->get('tmpl_core.item_rating')):?>

                    <div class="span2">

                        <?php echo $item->rating;?>

                    </div>

                <?php endif;?>

                <div class="span<?php echo ($params->get('tmpl_core.item_rating') ? 8 : 10);?>">

                    <small>

                        <dl class="dl-horizontal user-info">

                            <?php if($category):?>

                                <?php echo implode(' ', $category);?>

                            <?php endif;?>

                            <?php if($author):?>

                                <dt><?php echo JText::_('Posted');?></dt>

                                <dd>

                                    <?php echo implode(', ', $author);?>

                                </dd>

                            <?php endif;?>

                            <?php if($details):?>

                                <dt>Info</dt>

                                <dd class="hits">

                                    <?php echo implode(', ', $details);?>

                                </dd>

                            <?php endif;?>

                        </dl>

                    </small>

                </div>

                <?php if($params->get('tmpl_core.item_author_avatar')):?>

                    <div class="span2 avatar">

                        <img src="<?php echo CCommunityHelper::getAvatar($item->user_id, $params->get('tmpl_core.item_author_avatar_width', 40), $params->get('tmpl_core.item_author_avatar_height', 40));?>" />

                    </div>

                <?php endif;?>

            </div>

        </div>

    <?php endif;?>

</article>



<?php if($started):?>

    <script type="text/javascript">

        <?php if(in_array($params->get('tmpl_params.item_grouping_type', 0), array(1))):?>

            jQuery('#tabs-list a:first').tab('show');

        <?php elseif(in_array($params->get('tmpl_params.item_grouping_type', 0), array(2))):?>

            jQuery('#tab-main').collapse('show');

        <?php endif;?>

    </script>

<?php endif;?>













<?php

function group_start($data, $label, $name)

{

    static $start = false;

    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))

    {

        //tab

        case 1:

            if(!$start)

            {

                echo '<div class="tab-content" id="tabs-box">';

                $start = TRUE;

            }

            echo '<div class="tab-pane" id="'.$name.'">';

            break;

        //slider

        case 2:

            if(!$start)

            {

                echo '<div class="accordion" id="accordion2">';

                $start = TRUE;

            }

            echo '<div class="accordion-group">

                <div class="accordion-heading">

                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#'.$name.'">

                         '.$label.'

                    </a>

                </div>

                <div id="'.$name.'" class="accordion-body collapse">

                    <div class="accordion-inner">';

            break;

        // fieldset

        case 3:

            echo "<legend>{$label}</legend>";

        break;

    }

}



function group_end($data)

{

    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))

    {

        case 1:

            echo '</div>';

        break;

        case 2:

            echo '</div></div></div>';

        break;

    }

}



function total_end($data)

{

    switch ($data->tmpl_params['record']->get('tmpl_params.item_grouping_type', 0))

    {

        //tab

        case 1:

            echo '</div>';

        break;

        case 2:

            echo '</div>';

        break;

    }

}

 

I'm looking at it, but cannot for the life of me see any unexpected "<" - maybe I'm just losing my mind here in my corner..... :confused:

 

Thanks,

Jude
 

On line 634 add closing tag ?>

 

I'm guess you're new to PHP, you need to be more careful when go in and out of "php mode" with the <?php and ?> tags. A <?php tag must have a matching ?> tag. if you do not then you'll get errors like this. because you're going in an out of php mode so often it makes it more difficult to identify this issue. You also need to take the time making sure your codes syntax is correct. You cannot just copy 'n paste code somewhere and just expect it to work.

  • Solution

Many thanks, I will give that a try. And yes, I am (dreadfully) new to php and so everything is hard work and a headache, though I only ask for help when I've confused myself beyond redemption :happy-04:

 

In my defense, though, the only change I have made to the code is the inclusion of the table. The rest is as per the original template, so it is some comfort to know that others with much more experience occasionally miss the odd ?> i spend most of my time unraveling my confusion and working by trial and error. Not the best, and I have promised myself to find the time to make a concerted study of php before I die of old age. If nothing else, it will save me a lot of time, and others an equal amount of amusement. I have learned to laugh at myself.

 

Final note:  What I did find, after making the change and still having a problem with calling something that had previously been called (didn't copy and paste the error message) was that a section of code had been duplicated.

 

I have finally resolved this, and could not have done this without input from those who offered help.

 

Thank you so very much for your time and patience,

 

Jude

 

In my defense, though, the only change I have made to the code is the inclusion of the table.

I do give you credit for trying to modify a third-party script and learning php in the process. If you're still learning the language then you're bound to run into small little issues like this. Modifying third party scripts from someone else is not always easy as they are usually badly documented (lack of documentation/comments in the code) and poorly put together.
 

 

it is some comfort to know that others with much more experience occasionally miss the odd 

All pros get something wrong from time to time. No ones perfect
 

 

Final note:  What I did find, after making the change and still having a problem with calling something that had previously been called (didn't copy and paste the error message) was that a section of code had been duplicated.

Yeah I noticed that too. It is because of the functions group_start(), group_end and, total_end() were defined twice. Once you declare a function you cannot declare it again. If you do you'll get a duplication function error.
 
We got there in the end.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.