How to include within the Head in the Themes folder
Permalink
I have successfully been able to add a new line within the Head of a Theme in Packages; but I can't do the same with a Theme that I built myself and that only resides in the Application/Themes folder.
What I am trying to do: I want to add some extra PHP lines in an 'include' that can only sit within the "HTML' Head because it's a cookie consent script. Of course I can just add the stylesheet and the javascript directly in the head; but I want to centralize those lines in one single separate PHP file.
So I want to do something like this (see code block) - but strangely enough I get a PHP warning that tells me it's looking for the inlcude file in the 'concrete (!)' themes folder... the path is wrong; what to do...?
This is what my header.php file looks like (it's inside an Elements folder in the Theme in Application):
What I am trying to do: I want to add some extra PHP lines in an 'include' that can only sit within the "HTML' Head because it's a cookie consent script. Of course I can just add the stylesheet and the javascript directly in the head; but I want to centralize those lines in one single separate PHP file.
So I want to do something like this (see code block) - but strangely enough I get a PHP warning that tells me it's looking for the inlcude file in the 'concrete (!)' themes folder... the path is wrong; what to do...?
This is what my header.php file looks like (it's inside an Elements folder in the Theme in Application):
<!DOCTYPE html> <html lang="nl" xml:lang="nl" xmlns="http://www.w3.org/1999/xhtml"> <head> <?php Loader::element('header_required') ?> <!-- start cookie consent --> <?php $this->inc('/elements/cookies/cookie-consent-html.php'); ?> <!-- end cookie consent --> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="//fonts.googleapis.com/css?family=Roboto:100" rel="stylesheet"> <link href="<?= $view->getThemePath() ?>/css/main.css" rel="stylesheet" type="text/css" /> </head>