我将为我的最终Web开发课程项目构建一个CMS,并且我的老师在MVC系统中创建了它的挑战,现在,我将使用CodeIgniter.
因此,我想知道如何组织文件/文件夹结构.
我将使用一个简单的模板系统: - 现在我有一个自动加载的templates.php配置文件,并说明所选模板的名称,以及它的绝对路径. - templates文件夹位于views文件夹中(这是最正确的方法吗?) - 现在我有一些问题,通过视图中的文件访问.css文件,从我读过的人通常将所有文件放在应用程序文件夹之外.
你通常怎么做?而且,看到我正在建设什么,你能给我什么建议?视图不应包含模板中的所有内容吗?(包括模板文件夹中的CSS)
谢谢.
(我正在使用Code Ignitor 2.1.0)
编辑:
现在,在构建了所有文件和文件夹之后,我处于两难境地.我在constants.php中添加了以下内容
<!-- language: lang-php -->
$config['selected_template'] = 'oceania';
$config['template_abs_path'] = 'assets/templates/'.$config['selected_template'];
define('IMAGES_PATH', $config['template_abs_path'].'/img/' );
define('CSS_PATH', $config['template_abs_path'].'/css/' );
define('SCRIPTS_PATH', $config['template_abs_path'].'/js/' );
Run Code Online (Sandbox Code Playgroud)
(如果我没有定义selected_template和template_abs_path,我可以在常量中使用它们)
我将它们包含在HTML中,如下所示:
<!-- language: lang-html -->
<link rel="stylesheet" type="text/css" href="<?=CSS_PATH;?>style.css" />
Run Code Online (Sandbox Code Playgroud)
但是现在,我试图获得一个存储在配置中的标题,但我不能这样做,因为我需要所有这些变量都在我之前创建的其他templates.php文件中,否则它将无法识别我的变量.(我有模板自动加载)
templates.php
<!-- language: lang-php -->
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['title'] = 'Title of the website';
$config['selected_template'] = 'oceania';
$config['template_abs_path'] = 'templates/'.$config['selected_template'];
Run Code Online (Sandbox Code Playgroud)
header.php文件
<div id="logo">
<h1><a href="#"><?=$this->config->item('title');?></a></h1>
</div> …Run Code Online (Sandbox Code Playgroud) 如何通过API网关中的请求标头或查询字符串参数设置stageVariables?
我在集成请求中为lambda函数名称添加了stageVariable。当我在舞台上固定舞台变量时,它确实起作用。但是,当我尝试通过查询字符串设置变量时,出现服务器错误。
如何在API请求中动态设置Lambda版本?