Keyword

[SOLVED] syntax error, unexpected '$this' (T_VARIABLE), expecting fun

  • Thomas Thrane
  • Thomas Thrane's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 10 months ago - 7 years 10 months ago #153998 by Thomas Thrane
Hi

I'm getting this error on items in the front end:
syntax error, unexpected '$this' (T_VARIABLE), expecting function (T_FUNCTION)

Any clues?
I tried to reinstall K2, but same result.

I can use K2 Content Module as seen on the page: drive.thrane.nu/ (The 3 boxes), but it fails on an itempage: drive.thrane.nu/underside

Using Joomla 3.5.1
PHP 7.
K2 v2.7

Kind regards
Thomas
Last edit: 7 years 10 months ago by Thomas Thrane.

Please Log in or Create an account to join the conversation.

  • Thomas Thrane
  • Thomas Thrane's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 10 months ago - 7 years 10 months ago #154013 by Thomas Thrane
UPDATE!

Tried to delete /components/com_k2 and re-upload it.
Then the page works when I go to it, but after a refresh, the same error is shown?

The error seems to occour in these files
/components/com_k2/views/item/view.html.php
/components/com_k2/views/itemlist/view.html.php
Last edit: 7 years 10 months ago by Thomas Thrane.

Please Log in or Create an account to join the conversation.

  • Thomas Thrane
  • Thomas Thrane's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 10 months ago - 7 years 10 months ago #154016 by Thomas Thrane
UPDATE 2:

Seems like K2 is adding some wrong tags in the files mentione above when the page is accessed
In /components/com_k2/views/itemlist/view.html.php I found out that the code below is changing and the /**jk is added to the beginning and *7 is further down causing the page to fail.


/**jk// Set Facebook meta data
if($params->get('facebookMetatags', '1'))
{
$document = JFactory::getDocument();
$uri = JURI::getInstance();
$document->setMetaData('og:url', $uri->toString());
$document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
$document->setMetaData('og:type', 'website');
if ($task == 'category' && $this->category->image && strpos($this->category->image, 'placeholder/category.png') === false)
{
$image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $this->category->image);
$document->setMetaData('og:image', $image);
$document->setMetaData('image', $image);
}

$document->setMetaData('og:description', strip_tags($document->getDescription()));*/
}



If I remove the part with Facebook, the pages are fine?
Last edit: 7 years 10 months ago by Thomas Thrane.

Please Log in or Create an account to join the conversation.

  • Thomas Thrane
  • Thomas Thrane's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 10 months ago #154028 by Thomas Thrane
PROBLEM SOLVED!

It was the plugin Open Graph Protocol that had some issues with Joomla 3.5.1

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 10 months ago #154070 by Krikor Boghossian
Replied by Krikor Boghossian on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
Hello,

The links do not show any errors. Is this issue resolved (eg: template issue) ?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Thomas Thrane
  • Thomas Thrane's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 10 months ago #154085 by Thomas Thrane
Please see my post above :-)

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 10 months ago #154122 by Krikor Boghossian
Replied by Krikor Boghossian on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
Thank you for reporting the culprit :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Thomas Thrane
  • Thomas Thrane's Avatar Topic Author
  • Offline
  • Premium Member
More
7 years 10 months ago #154141 by Thomas Thrane
You're welcome!
You can close this thread.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 10 months ago #154157 by Krikor Boghossian
Replied by Krikor Boghossian on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
Will do :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum