R
R
Ranger Nicholas2018-07-12 06:31:50
PHP
Ranger Nicholas, 2018-07-12 06:31:50

PHP connection not working in tpl template, what could be the reason?

Help me figure out what I'm doing wrong?
I want to place the text only on the main page. Pages consist of blocks of .tpl templates.
I know that php will not work in .tpl. But!

  1. I tried to prescribe a condition with the code between {php}{/php}
  2. I tried to connect an external file to the template: I created a file with the .php extension in the folder with the template. In this file I wrote <?php if($_SERVER['REQUEST_URI'] == '/'){?> my code <? }?> and tried to display it in the template itself like this {include_php file="weather.php"} did not help, it gives a white page.

Tell me, are there any other options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2018-07-12
@alekssamos

When I figured it out, this article helped me understand the patterns here phpfaq.ru/tech/tpl

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question