×

Please Login or Register to continue.

4
(6.1K Views)

I am using the Question2Answer  QA application. Currently, I am using Question2Answer  QA version 1.8.2. 

When I installed Q2A-Blog-Post-Plugin-master on the QA application it gave an error.

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; qa_layer_1_from_blog_admin_php has a deprecated constructor in qa\qa-include\qa-base.php(720) : eval()'d code on line 22
of C:\xampp\htdocs\qa\qa-plugin\blog-post/blog-admin.php

 There is an error with the Q2A Blog Post Plugin master.

The 22  line code is here - 

class qa_html_theme_layer extends qa_html_theme_base {

var $plugin_directory;

var $plugin_url;

function qa_html_theme_layer($template, $content, $rooturl, $request)

{

global $qa_layers;

$this->plugin_directory = $qa_layers['Blog Settings']['directory'];

$this->plugin_url = $qa_layers['Blog Settings']['urltoroot'];

qa_html_theme_base::qa_html_theme_base($template, $content, $rooturl, $request);

}

How can I remove this error from the Q2A Blog Post Plugin master? I tried a lot of ways but I didn't get any solution regarding "Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP"

(9.2K Points)
in PHP

Share

2 Answers
(210 Points)
3

As you know that PHP 7 had been launched. If you are using PHP5 version then you need to change small thing related to your solution. 

deprecated means 

Have you notice the depreciated word in your error -

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP

 

 

The means of deprecated that it will be removed in the future. So understand the PHP7 concepts, 

In PHP 5, you never seen the function like.__construct()

 . 

Change the function like.__construct() . You need to use __construct().

Understand this and remove your QA BLOG post error. 

 


Comment
Can you please explain using my code ?
shakti 29 Dec 2018
Thanks for sharing this valuable information about the error - Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP This is solved .
sunnypundir 26 Apr 2019

(4.2K Points)
4

First, navigate your error file - 

qa>qa-plugins>blog-post>blog-admin.php

Jump to the line 22 . 

Use __construct  with the same name as your class :

class qa_html_theme_layer extends qa_html_theme_base {

var $plugin_directory;

var $plugin_url;

function -qa_html_theme_layer($template, $content, $rooturl, $request)

{

global $qa_layers;

$this->plugin_directory = $qa_layers['Blog Settings']['directory'];

$this->plugin_url = $qa_layers['Blog Settings']['urltoroot'];

qa_html_theme_base::qa_html_theme_base($template, $content, $rooturl, $request);

}

I have changed - 

function qa_html_theme_layer($template, $content, $rooturl, $request)

To 

function _qa_html_theme_layer($template, $content, $rooturl, $request)

Hope it will help. 


Comment
Thank you Priyasharma4005. My problem has been solved
shakti 29 Dec 2018

Related Questions :-

Featured Items:-


Certificate system in PHP website | PHP scripts

$37



Home Credito loan finance management multipurpose system in PHP

$98



Result management system with Marksheet in PHP website | PHP Scripts

$48




Your Answer

You can post your answer after login..