WebSite X5Help Center

 
Valeriy  Khalif
Valeriy Khalif
User

How to insert HTML code into text?  ru

Author: Valeriy Khalif
Visited 1248, Followers 1, Shared 0  

How to insert HTML code into text?
Please help with this question.
I need to greet the User who visited the page (limited access).
To do this, I need to add PHP code to the inside of the text field or table field. To do this, in the "Text object" there is a button "Include HTML code"
or I'm wrong?!
Full code
<? php
$ pa = new imPrivateArea ();
$ user = $ pa-> who_is_logged ();
echo $ user ['realname'];
?>
But since the "restricted page" already has the code:
<? php require_once ("res / x5engine.php"); ?>
<? php imCheckAccess ('15 ',' '); ?>
is it enough to just execute the command:
echo $ user ['realname']; or is it necessary to embed the full code, as I indicated above?
The main question is, how do I declare inside the text field that I need to display the result of the "variable $ user ['realname']"?
Below are the chamois.

EROR 

If I am mistaken, tell me how can I display the "translated" inside a text box or table?

Posted on the
7 ANSWERS - 1 CORRECT
Valeriy  Khalif
Valeriy Khalif
User
Author

P.S.
With this arrangement of blocks and adding the block "HTML code" and insert PHP code in it

<? php
$ pa = new imPrivateArea ();
$ user = $ pa-> who_is_logged ();
echo $ user ['realname'];
?>

Everything works as it should.

Everything works, but I would like to understand why then in the editor there is (button) - "Enable HTML code"?
You can of course break the page into a lot of blocks and embed the "HTML code" block. It’s more difficult to withstand beauty.

Read more
Posted on the from Valeriy Khalif
Aleksej H.
Aleksej H.
Moderator

Hello.

"why then in the editor there is (button) - "Enable HTML code"?" - для вставки HTML кода, а не PHP кода.

Read more
Posted on the from Aleksej H.
Александр К.
Александр К.
Moderator

Hello Valeriy / Привет Валерий.

I dig, such cases happen even with pro...)))
You try to do something that would work, but it turns out pear shaped.
In this case the html object does not support PHP, Sod’s Law.

Я тащусь, такое бывает даже с профи. )))
Вы пытаетесь сделать что-то, что бы сработало, но получается все на перекосяк.
В данном случае блок HTML не поддерживает код PHP, как назло.

Read more
Posted on the from Александр К.
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Александр К.
... ... ...  В данном случае блок HTML не поддерживает код PHP, как назло.

(It > Ru)  ... не правда; ... всегда можно использовать код PHP ...wink
... для того, чтобы код PHP работал, страница хоста должна иметь расширение в PHP: pagename.php  ... и страница должна быть экспортирована в СЕТЬ на сервере, который поддерживает код PHP ...
... Идеальный объект - это объект HTML-кода ...
... код PHP также может работать в текстовом объекте с поддержкой HTML с помощью кнопки [</>];
... в этом случае код PHP должен быть в одной строке, без возврата каретки, (carriage return) ...

привет, ciao

.

Read more
Posted on the from  ‪ KolAsim ‪ ‪
Valeriy  Khalif
Valeriy Khalif
User
Author
 ‪ KolAsim ‪ ‪
Александр К. ... ... ...  ... код PHP также может работать в текстовом объекте с поддержкой HTML с помощью кнопки [</>]; ... в этом случае код PHP должен быть в одной строке, без возврата каретки, (carriage return) ...

Я именно об єтом и спрашивал. Как встроить код PHP или скажем отдельную переменную PHP (код в страницк можно включить с помощью include или <?php require_once("outvar.php"); ?> эту строку нужно поставить в свойствах страницы закладка Эксперт и конечно же страницу необходимо переименовать как *.php   - это все понятно! 

У меня был вопрос о том как именно вставить в строку "Текстового объекта" код PHP точнее саму переменную PHP? Было бы очень хорошо, если бы вы привели пример такой строки.

Как поддерживать текстовый формат вывода переменной PHP в том виде который мне необходим? 

Ваш проект WebSite X5 вообще не хочет поддерживать работу с DB (базами данных), а конкретно работу с переменными с базы данных. 

Был бы еще вам безмерно благодарен, если бы вы научили вытаскивать "Переменную с DB"? Только не код PHP для запроса, а конкретно как у вас построен запрос к DB и конкретной Таблицы DB. Дело в том что у вас применена очень мудраясистема безопасности доступа к DB MySQL Конкретно чере require_once("res/x5engine.php"); Наример код:

<?php
require_once("res/x5engine.php");
$pa = Configuration::getPrivateArea();
$user = $pa->whoIsLogged();
$uid=$user['uid'];
$qchiave = array_keys($imSettings['databases']);
$qchiave = array_keys($imSettings['databases']);
$qdati = getDbData($qchiave[0]);
$host = $qdati['host'];
$db_user = $qdati['user'];
$db_psw = $qdati['password'];
$db_name = $qdati['database'];
$qfolder = $imSettings['general']['public_folder'];
$tabella = $imSettings['access']['dbtable'];
$conn = new mysqli ($host, $db_user, $db_psw, $db_psw);
if ($conn->connect_error) { die("Connessione fallita: " . $db->connect_error); } 
?>

Что самому в отдельном PHP файле получить доступ к DB всегда нужно входить через такой код с применением array_keys($imSettings['databases']? При этом в файле x5engine.php не лежат в отрытом виде db_user, db_psw, db_psw Это было бы очень полезно для развития вашего проекта. 

Read more
Posted on the from Valeriy Khalif
Valeriy  Khalif
Valeriy Khalif
User
Author
Aleksej H.
Hello. ‎"Почему тогда в редакторе есть (кнопка) - "Включить HTML-код"?"‎ - для вставки HTML кода, а не PHP кода.

These two concepts differ only in those who process the page: your browser or PHP server, and of course what you call this page * .html or * .php. You yourself have the right to choose the page properties, Expert - file extension.

Read more
Posted on the from Valeriy Khalif
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

(It > Ru) ... Я могу только сказать вам, что в текстовом объекте код PHP должен быть в строке, без возврата каретки ...
... например:
текст текст текст текст текст <?php   код код код ......... .... ... ... ... ... ... ... ... ... .. . ... ... ... ... .... .... ... код код код  ?> текст текст текст текст
текстовый текст текстовый текст
... вместо функций PHP, о которых я не могу сообщить, вы должны документировать себя в сети ...

ciao

.

Read more
Posted on the from  ‪ KolAsim ‪ ‪