【问题标题】:How to add chat button or any button that will display on all pages in codeigniter 3 application?如何在 codeigniter 3 应用程序的所有页面上添加聊天按钮或任何按钮?
【发布时间】:2022-11-01 23:24:11
【问题描述】:

在 codeigniter 3 文件结构中找不到根 index.html 文件。 我想显示一个应该在所有页面上可见的聊天按钮。

我必须查找哪个文件?

该按钮显示在所有页面上,但它紧贴在标题之后,我猜它与正文无关

这是包装应用程序的 Template.php 文件-

<body style='position:relative,z-index:10'>
 
<?php $this->load->view('website/layout/header'); ?> 
 
<?php $this->load->view('website/layout/whatsapp_button');?>
<?php $this->load->view('website/'.$content);?>
     
</div> 
<?php $this->load->view('website/layout/footer'); ?>
</body>

whatsapp_button.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" 
name="viewport" />
<meta name="description" content="" />
<meta name="author" content="" />


</head>

<body>
 <!-- start header -->
 <div className=''>
      <a style='position:absolute,font-size:20px,z- 
          index:100,top:500px' 
         target='_blank' 
        href='https://api.whatsapp.com/send?phone='>
        Chat
      </a>
</div>

</body>
</html>

【问题讨论】:

    标签: php codeigniter bootstrap-4 codeigniter-3


    【解决方案1】:

    没有这样的文件。视图(您的 html 输出)是从控制器加载的

    控制器索引函数(或加载 html 输出的任何位置)中的典型结构可能是:

    $this->load->view('header', $data);
    $this->load->view('content');
    $this->load->view('footer');
    

    例如在哪里header 可以保存您的菜单和页脚所有脚本

    将您的按钮放在其中之一中,因为您将始终加载页眉和页脚

    更多:Loading Codeigniter 3 Pages

    【讨论】:

    • 请检查编辑
    猜你喜欢
    • 2022-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-29
    • 1970-01-01
    • 1970-01-01
    • 2015-08-09
    • 2011-04-18
    相关资源
    最近更新 更多