doumao6212 2019-04-22 06:00
浏览 142

如何在PHP / tpl中包含JS / CSS?

I downloaded the virtual keyboard, and can't include in my website, i read the tutorial, it says that you need to put:

<script type="text/javascript" src="keyboard.js" charset="UTF-8"></script>
<link rel="stylesheet" type="text/css" href="keyboard.css">

this code in the <head>, so i have to files,.php and .tpl, I tried to add it to both files, but nothing happened, has anyone encountered such a problem?

in .tpl

<script type="text/javascript" src="keyboard.js" charset="UTF-8"></script>
<link rel="stylesheet" type="text/css" href="keyboard.css">

<main class="main" style="padding:0; overflow-x:initial">
    <div class="container">
        {include file="engine/modules/products/eogpo.php"}
    </div>
</main>
<div id="isTerminal"></div>

<div id="modalError" class="modal info__modal" data-modal>
    <button data-izimodal-close="" class="modal__close">
        <svg class="icon icon-close"><use xlink:href="/images/sprite.svg#icon-close"></use></svg>
    </button>
    <div class="modalStyle">
        <h3 class="info__title" id="errorTitle"><?php echo _("Ошибка"); ?></h3>
        <div id="textError"></div>
    </div>
</div>

<div id="modalInfo" class="modal info__modal" data-modal>
    <button data-izimodal-close="" class="modal__close">
        <svg class="icon icon-close"><use xlink:href="/images/sprite.svg#icon-close"></use></svg>
    </button>
    <div class="modalStyle">
        <div id="textInfo"></div>
    </div>
</div>

<div id="overLoader" style="display: none"><img src="/templates/assets/images/loading.gif" alt="Loading..." /></div>

i'm added at the top

in .php

<script type="text/javascript" src="keyboard.js" charset="UTF-8"></script>
<link rel="stylesheet" type="text/css" href="keyboard.css">
<?php
//ini_set('error_reporting', E_ALL);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
session_start();
?>


<style>
.calculator__bloc:last-child {
    margin-bottom: 0;
}
.calculator__bloc {
    position: relative;
    padding: 30px 37px 34px;
    border-radius: 5px;
    margin-bottom: 20px;
}
.calculator__clos {
    position: absolute;
    right: 25px;
    top: 25px;
}
</style>

did the same

  • 写回答

1条回答 默认 最新

  • douweinu8562 2019-04-22 06:18
    关注

    There is an option that you need to put special html tag in your .tpl file for keyboard.js. You can check it in documentation.

    Also may be you lost init script for js to start - also you can check in the documentation.

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序