W
W
WarOff1k2017-12-16 00:51:25
css
WarOff1k, 2017-12-16 00:51:25

How to see a variable through class function include?

There is an index.php file

include __DIR__ . '/lib/mysql.php';   // класс "MySQLPDO" подключили
include __DIR__ . '/lib/engine.php'; // класс "engine" подключили

$engine = new engine;
$engine->route(); // парсим урл

engine.php file
class engine  extends MySQLPDO {
   public function route()
   {
      include __DIR__ . '/../tpl/header.php';
   }
}

And so all a hogwash all that without specifying global the header.php file does not see $engine... Why?! How is that even possible? Ordinary variables through the usual include sees PHP. How to be in this case?
Please don't kick with your feet. I've only been learning PHP for a couple of days.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Salavat Salakhutdinov, 2019-10-05
@Jackardios

1) Use negative margin starting from a certain width (+ be sure to set overflow:hidden for the container, otherwise there will be a horizontal scrollbar)
For example

.header {
  overflow:hidden;
}
@media (min-width: 1300px) {
  .header-logo {
    margin-left: -100px;
  }
}

2) Make a common container for the background and content, while the background will be as position: absolute, and the content as position: relative
<div class="hero-section">
  <div class="hero-section__bg">
    ...контент фона
  </div>
  <div class="hero-section__content">
    <div class="container">
      ...контент
    </div>
  </div>
</div>

.hero-section {
  position: relative;
}
.hero-section__content {
  position: relative;
  z-index: 1;
}
.hero-section__bg {
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  right: 0;
  width: 100%;
}
@media (min-width: 900px) {
  .hero-section__bg {
    width: 45%;
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question