หากอัพเดท
Joomla เป็นเวอร์ชั่น 3.8.0 ขึ้นไป หลังจากนั้นเข้าหน้าที่ไม่มีในเว็บ หรือ ทำ Error ที่หน้าเว็บ คุณอาจจะเจอข้อความแจ้งแบบด้านล่าง
โค้ด: เลือกทั้งหมด
Warning: require_once(/***.com/httpdocs/libraries/joomla/document/html/renderer/head.php): failed to open stream: No such file or directory in /***.com/httpdocs/templates/vina_erida/error.php on line 27
Fatal error: require_once(): Failed opening required '/***.com/httpdocs/libraries/joomla/document/html/renderer/head.php' (include_path='.:/opt/plesk/php/7.0/share/pear') in /***.com/httpdocs/templates/vina_erida/error.php on line 27
เป็นเพราะใน
Joomla เวอร์ชั่น 3.8.0 มีการปรับโครงสร้างของ Class ใหม่ ไปใช้
Namespace ทำให้มีปัญหาหา Class ไม่เจอ
จาก Error ด้านบนเกิดจากหา Class ชื่อ JDocumentRendererHead ไม่เจอ ในไฟล์ชื่อ error.php ในโฟลเดอร์ templates ที่ใช้อยู่
แก้จาก
โค้ด: เลือกทั้งหมด
require_once(JPATH_LIBRARIES.'/joomla/document/html/renderer/head.php');
$header_renderer = new JDocumentRendererHead($doc);
$header_contents = $header_renderer->render(null);
เป็น
โค้ด: เลือกทั้งหมด
$header_renderer = new Joomla\CMS\Document\Renderer\Html\HeadRenderer($doc);
$header_contents = $header_renderer->render(null)
หากอัพเดท [url=https://www.mindphp.com/%E0%B8%84%E0%B8%B9%E0%B9%88%E0%B8%A1%E0%B8%B7%E0%B8%AD/73-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/2620-joomla-cms.html]Joomla[/url] เป็นเวอร์ชั่น 3.8.0 ขึ้นไป หลังจากนั้นเข้าหน้าที่ไม่มีในเว็บ หรือ ทำ Error ที่หน้าเว็บ คุณอาจจะเจอข้อความแจ้งแบบด้านล่าง
[code]Warning: require_once(/***.com/httpdocs/libraries/joomla/document/html/renderer/head.php): failed to open stream: No such file or directory in /***.com/httpdocs/templates/vina_erida/error.php on line 27
Fatal error: require_once(): Failed opening required '/***.com/httpdocs/libraries/joomla/document/html/renderer/head.php' (include_path='.:/opt/plesk/php/7.0/share/pear') in /***.com/httpdocs/templates/vina_erida/error.php on line 27[/code]
เป็นเพราะใน [url=https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/34-joomla/4671-joomla-3-8-release.html]Joomla เวอร์ชั่น 3.8.0[/url] มีการปรับโครงสร้างของ Class ใหม่ ไปใช้ [url=https://www.mindphp.com/developer/25-oop-php-framework/3203-function-namespace-in-php.html]Namespace[/url] ทำให้มีปัญหาหา Class ไม่เจอ
จาก Error ด้านบนเกิดจากหา Class ชื่อ JDocumentRendererHead ไม่เจอ ในไฟล์ชื่อ error.php ในโฟลเดอร์ templates ที่ใช้อยู่
แก้จาก [code=php]require_once(JPATH_LIBRARIES.'/joomla/document/html/renderer/head.php');
$header_renderer = new JDocumentRendererHead($doc);
$header_contents = $header_renderer->render(null);[/code]
เป็น [code=php]$header_renderer = new Joomla\CMS\Document\Renderer\Html\HeadRenderer($doc);
$header_contents = $header_renderer->render(null)[/code]