简体   繁体   中英

PHP include does not show the full file

I am trying to include an html "piece". The piece is simply a header with a comment at the top:

<!--
Flex Web Core v2.0.2
Available in Perforce //FlexWeb/v2.0.2
Date: 2016-04-07T16:30:29
-->

<header class="page-header">
    <div class="page-header__inner"><a href="#" class="logo"></a>
    </div>
</header>

this file is called header-basic.html .

in my index.php file I have this line to include the header-basic.html

 <?PHP include 'node_modules/flexwebcore/dist/html/blocks/header-basic.html'; ?>

The basic-header html does not show up (whether it's a .php or .html file being included). When I inspect the code, I can see the comment of the header-basic file, but I do not see the HTML being included. Any ideas?

Here's where it's included:

<body>
    <div class="page-container">
        <!-- Place Header Here -->
        <?PHP include 'node_modules/flexwebcore/dist/html/blocks/header-basic.html'; ?>
        <main class="page-main">
        </main>
    </div>
</body>

EDIT So, I believe I've found that only the header and footer files are not showing up. Is there a problem with including <header> and <footer> tags? The location that they are being included into are valid.

而是尝试执行require_once并查看会发生什么..可能是由于注释..尝试删除注释并尝试一下...您可以将注释放入主文件。

In js/global.js you have a Javascript function that's removing the <header> element:

function page_type_change(page_type) {
    $('header').remove();
    $('footer').remove();
    $('.page-container').removeClass('page-container--footer-full');
    //$('.page-container').prepend(getHeader(page_type));
    $('body').append(getFooter(page_type));
    if(page_type === "pre" || page_type === "post"){
        $('.page-container').addClass('page-container--footer-full');
    } else {
        $('.page-container').removeClass('page-container--footer-full');
    }
}

You need to fix this function or your HTML to match what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM