The p...">

PHP posting problem

I call this function halfway down the page:

    <div id="leftArea">
        <?php
        if (isset($id)){
            single($id);
        }
        ?>
    </div>

The problem is that I want to use some of the results in the meta tags in <head>, what is the best way to approach this?

EDIT:

The only function accepts the identifier $ id and displays the data directly to the page where exactly. In DIV leftArea. But I want to take one of the rows from the database and paste it into the META tags at the top

+3
source share
2 answers

Copy the code to the section <head>.

+1
source

Redesign your system

The best way is to create a class that manages your html page, for example:

$Page = new HTMLPage("My Page",HTMLPage::Strict);

$Page->addScript("....");
$Page->addScript("....");
$Page->addScript("....");

$Page->addStyle("....");
$Page->addStyle("....");
$Page->addStyle("....");

$Page->SetBody($MyTemplate);

$Page->send();

that way, although you can perform your functions

function myfunc()
{
    global $Page;
    $Page->addScript("....");
}

, , , , .

, , . ( )

+1

Source: https://habr.com/ru/post/1794857/


All Articles