Here you need to extend this function to your php host. I saved on the host a file with DLE, where the set function is located.

PHP code:

include ("./templates.class.php"); 

and still it shows:

Fatal error: Call to a member function set() on a non-object in /home/makar3000/html/****/index.php on line 18

PHP code:

 $tpl->set( '$login', $PHP_SELF . "?do=login" ); 
  • I did not understand the answer ... I need to pull it out, but you have written off-topic at all = ( - Makar
  • Here I myself want to know. And I ask you to help me pull out this component ... - Makar
  • @shurik says that you are trying to work with an object that was not created. The $tpl variable is a dummy until it is initialized by the class constructor. Because of this error. There must be something like: $ tpl = new ClassName (blah blah blah); $ tpl-> set ('$ login', $ PHP_SELF. "? do = login"); - KiTE 2:41 pm
  • rghost.ru/13224641 - Makar

2 answers 2

Judging by the source code, if you use templates.class.php separately from DLE, then there should be something like:

 $tpl = new dle_template(); $tpl->load_template("template_name"); $tpl->set( '$login', $PHP_SELF . "?do=login" ); 
  • Well, look, I specify $tpl->load_template("путь к шаблону main.tpl"); and the template is not loaded + $tpl->set( '$login', $PHP_SELF . "?do=login" ); does not work. - Makar
  • Judging by the source code of the load_template() method, the template files should be in the same folder as templates.class.php . And as $tpl_name you need to specify the name of the file without the path to it. - KiTE
  • I did it but .... I need to do a redirect here, let's say there is: $ tpl-> sub_load_template ('login.tpl') I need it to open at index.php? Do = login. But I can't do it like this = (+> if ($ PHP_SELF ['login']) {include> ("./templates/login.tpl");}; it won't work! Because I need to use a lot of templates - Makar

The answer is obvious, $ tpl is not an object. Make var_dump ($ tpl); and see for yourself.

  • No, it does not work either - Makar