- Posts: 132
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] syntax error, unexpected '$this' (T_VARIABLE), expecting fun
[SOLVED] syntax error, unexpected '$this' (T_VARIABLE), expecting fun
- Thomas Thrane
-
Topic Author
- Offline
- Premium Member
Less
More
8 years 11 months ago - 8 years 11 months ago #153998
by Thomas Thrane
syntax error, unexpected '$this' (T_VARIABLE), expecting fun was created 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
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: 8 years 11 months ago by Thomas Thrane.
Please Log in or Create an account to join the conversation.
- Thomas Thrane
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 132
8 years 11 months ago - 8 years 11 months ago #154013
by Thomas Thrane
Replied by Thomas Thrane on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
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
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: 8 years 11 months ago by Thomas Thrane.
Please Log in or Create an account to join the conversation.
- Thomas Thrane
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 132
8 years 11 months ago - 8 years 11 months ago #154016
by Thomas Thrane
Replied by Thomas Thrane on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
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?
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: 8 years 11 months ago by Thomas Thrane.
Please Log in or Create an account to join the conversation.
- Thomas Thrane
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 132
8 years 11 months ago #154028
by Thomas Thrane
Replied by Thomas Thrane on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
PROBLEM SOLVED!
It was the plugin Open Graph Protocol that had some issues with Joomla 3.5.1
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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 11 months ago #154070
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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) ?
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
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 132
8 years 11 months ago #154085
by Thomas Thrane
Replied by Thomas Thrane on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
Please see my post above :-)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 11 months ago #154122
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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
-
Topic Author
- Offline
- Premium Member
Less
More
- Posts: 132
8 years 11 months ago #154141
by Thomas Thrane
Replied by Thomas Thrane on topic syntax error, unexpected '$this' (T_VARIABLE), expecting fun
You're welcome!
You can close this thread.
You can close this thread.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 11 months ago #154157
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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.
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] syntax error, unexpected '$this' (T_VARIABLE), expecting fun