Page 1 of 1
Error: Use of undefined constant DS
Posted: 10 Jun 2015, 21:04
by bscivolette
Good Afternoon,
I recently enabled the Open Graph plugin and I found that I receive the following error on every page. Any idea what might be causing it?
Notice: Use of undefined constant DS - assumed 'DS' in C:\inetpub\wwwroot\public\plugins\content\phocaopengraph\phocaopengraph.php on line 114
Re: Error: Use of undefined constant DS
Posted: 12 Jun 2015, 14:49
by Jan
Hi, which version of Joomla! and which version of the plugin you are using, seems like incompatible versions are used.
Jan
Re: Error: Use of undefined constant DS
Posted: 31 Jan 2016, 19:46
by trombini
Hello I´m new here in this forum but of Joomla not so dumie
Well I had the same problem and after see a lot of post in many websites about this problem here is what I found and hope it help.
Have a time that the DS constant is not more used in Joomla system and is necessary to chage it for DIRECTORY_SEPARATOR
So this plugin in the file root\plugins\content\phocaopengraph\phocaopengraph.php from line 257 to 267 is possible to sse that is used DS. So only replace it with DIRECTORY_SEPARATOR save and upload.
Is a rule in the Joomla development that was not updated in this plugin here. So if anybody knows any developer here please follow up.
Thanks and if I gave some wrong description, please fix me
Regards,
Leandro.
Re: Error: Use of undefined constant DS
Posted: 01 Feb 2016, 01:14
by HerKle
Hi, I had the same problem today and found this solution – together with the message "The DS constant has been removed in Joomla 3" – on web357[dot]eu to fix it until the plugin follows Joomla's new rules:
Code: Select all
<?php
/* BEGIN: for joomla 3 projects */
JLoader::import( "joomla.version" );
$version = new JVersion();
if (!version_compare( $version->RELEASE, "2.5", "<=")) :
if (!defined("DS")):
define("DS", DIRECTORY_SEPARATOR);
endif;
endif;
/* END: for joomla 3 projects */
?>
This worked for me.
Regards,
Herbert
Re: Error: Use of undefined constant DS
Posted: 03 Feb 2016, 15:38
by Jan
Hi, the standard way is:
- correct all DS to /
- if this is not possible because e.g. of time issues - quick fixes to make the extension working, this code is added:
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
This part added to the header of main extension file solves the problem. You don't need to add specific IF conditions, this line solves it everything.
If this line is in 2.5, nothing will change as the DS is defined there, so this line will be ignored
If this line is in 3, the DS will be defined - so in fact - on constant is defined and such solves all the problems.
In this file:
plugins\content\phocaopengraph\phocaopengraph.php
Quick fix:
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
or update to the latest version - for now, it is 3.0.4:
https://www.phoca.cz/download/category/6 ... aph-plugin
Let me know if updating to the latest helps (the DS was changed to /)
Thank you, Jan