Topic-icon Blank page when trying to use custom tags

Active Subscriptions:

None
I insert the tag in my php code like this example {JFBCComments}, and get a blank page
Comments are working well in regular article
Thanks
The topic has been locked.
Support Specialist
10 years 2 weeks ago #58342 by mel
Generally when you see a blank page, there is a PHP error. Please make sure that Error Reporting is set to Maximum or Development mode in the Joomla Global Configuration area and let us know if there are any errors on the page or on the console.

Also, please check the JFBConnect backend > Social > Misc section to see if there is a render key set up. If so, you will need to add it to your easy-tag such as
{JFBCComments key=1234}

If these suggestions don't help, please provide a specific URL so that we can see the problem in action.

-Melissa
The topic has been locked.
Active Subscriptions:

None
10 years 2 weeks ago #58352 by savoirdonner
Thanks for your reply

Here is the error message

Parse error: syntax error, unexpected 'key' (T_STRING) in /var/www/clients/client0/web18/web/components/com_competition/views/competition/view.html.php on line 429

{JFBCComments key=1234} is on the last line



<?php

/**

* @package Norr_Competition

* @author Dmitry Rekun <This email address is being protected from spambots. You need JavaScript enabled to view it.>

* @copyright Copyright (C) 2015 - 2016 NorrNext. All rights reserved.

* @license GNU General Public License version 3 or later; see license.txt

*/



defined('_JEXEC') or die;



/**

* View class for the category

*

* @since 1.0

*/

class CompetitionViewCompetition extends CompetitionView

{

/**

* The participants

*

* @var array

* @since 1.0

*/

protected $items;



/**

* The pagination

*

* @var JPagination

* @since 1.0

*/

protected $pagination;



/**

* The state of model

*

* @var object

* @since 1.0

*/

protected $state;



/**

* The competition

*

* @var object

* @since 1.0

*/

protected $competition;



/**

* The custom fields

*

* @var CompetitionFields

* @since 1.0

*/

protected $fields;



/**

* The grand prix participant

*

* @var object

* @since 1.0

*/

protected $grandPrixParticipant;



/**

* The participants with highest rating

*

* @var array

* @since 1.0

*/

protected $highestRatingItems;



/**

* The voting is allowed or not

*

* @var boolean

* @since 1.0

*/

protected $votingAllowed;



/**

* Display the view

*

* @param string $tpl The name of the template file to parse

*

* @return void

*

* @since 1.0

*/

public function display($tpl = null)

{

$app = JFactory::getApplication();

$model = $this->getModel();



try

{

$this->competition = $model->getCompetition();

$this->state = $model->getState();

$this->items = $model->getItems();

$this->pagination = $model->getPagination();



// Check for errors (legacy method)

if (count($errors = $this->get('Errors')))

{

$app->enqueueMessage(

JText::_('COM_COMPETITION_ERROR_OCCURRED'),

'error'

);



JLog::add(implode("\n", $errors), JLog::ERROR, 'com_competition');



return;

}



// Active competition

if ($this->competition->status == 1)

{

// Rating is enabled and allowed

$this->votingAllowed = $model->isVotingAllowed();

}



// Closed competition

if ($this->competition->status == 0)

{

$this->grandPrixParticipant = $model->getGrandPrixParticipant();

$this->highestRatingItems = $model->getHighestRatingParticipants();

$this->fields = new CompetitionFields;



$this->setLayout($this->getName() . '_result');

}



$this->prepareDocument($this->competition->title, $this->competition);



JPluginHelper::importPlugin('competition');

$app->triggerEvent('onCompetitionDisplay', array('com_competition.competition', $this->competition));



parent::display($tpl);

}

catch (Exception $e)

{

$app->enqueueMessage(

JText::_('COM_COMPETITION_ERROR_OCCURRED'),

'error'

);



JLog::add($e->getMessage(), JLog::ERROR, 'com_competition');



return;

}

}



/**

* Method to prepare the document

*

* @param string $defPageTitle The default page title

* @param object $item The item with metadata

*

* @return void

*

* @since 1.0

*/

protected function prepareDocument($defPageTitle = '', $item = null)

{

// Set breadcrumbs and titles

$app = JFactory::getApplication();

$menu = $app->getMenu()->getActive();

$id = (int) @$menu->query;



// If no menu item or the menu item does not concern this competition

if (!$menu || ($menu

&& $menu->query != 'com_competition'

|| $menu->query != 'competition'

|| $id != $this->competition->id))

{

$app->getPathway()->addItem(

$this->competition->title,

CompetitionHelperRoute::getCompetitionRoute($this->competition->id . ':' . $this->competition->alias)

);

}



parent::prepareDocument($defPageTitle, $item);



$this->setOpenGraphData();

}



/**

* Method to set the Open Graph data to the page

*

* @param object $ogObject The object with og data

* @param array $options The array of additional options like Twitter card types

*

* @return void

*

* @since 1.1

* @throws InvalidArgumentException

*/

protected function setOpenGraphData($ogObject = null, array $options = array())

{

$image = $this->competition->getParams()->get('competition_image', '');



$ogObject = new stdClass;

$ogObject->title = $this->competition->title;

$ogObject->image = !empty($image) ? JUri::base() . $image : '';

$ogObject->description = !empty($this->competition->metadesc) ? $this->competition->metadesc : $this->competition->description;



parent::setOpenGraphData($ogObject);

}

}

{
JPluginHelper::importPlugin('content');
$share = plgContentBt_socialshare::socialButtons();
echo $share; // Required
echo $share; // Social button
echo $share; // Recommendation bar
echo $share; // facebook comment box

}

{JFBCComments key=1234}
The topic has been locked.
Support Specialist
10 years 2 weeks ago #58357 by mel
How you're including it is incorrect. PHP will process that and fail. You will need to echo it out instead, like the following:
echo '{JFBCComments key=1234}';
The topic has been locked.
Active Subscriptions:

None
10 years 1 week ago #58368 by savoirdonner
I's working , thanks
Why do i have them twice ?

File Attachment:
The topic has been locked.
Support Specialist
10 years 1 week ago #58373 by alzander
It's there twice because that file is likely being loaded twice. We wouldn't recommend adding the {JFBCComments} tag where you are. It should be within the template (output HTML) of whatever extension you're trying to include it in. The file you look to be adding it to is the functional file which does the work to setup the page, and it may be called repeatedly to do so, which is why the comment box is appearing multiple times.

I hope that helps explain. You may want to contact the developer of the extension you're trying to add the comment box to to get feedback on how best to alter their output.

Thanks,
Alex
The topic has been locked.