我面临的问题是,我不确定如何在没有框架或模板引擎的情况下开发.我开始编码,现在我想去基础.
我曾经使用过这个MVC架构,使用Codeigniter和Smarty作为模板引擎.我现在要做的是使用原始的PHP而不提及这两种工具.
我不知道如何"复制"Smarty的"块"和"扩展"的概念.
我曾经定义了一个base.tpl文件,它有html头,只有body标签,以及基本css和js文件(在网站的每个页面中总是使用的文件),如下所示:(片段)
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>Dashboard</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<!-- ================== BEGIN BASE CSS STYLE ================== -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href="{site_url()}assets/css/animate.min.css" rel="stylesheet" />
<!-- ================== END BASE CSS STYLE ================== -->
<!-- ================== BEGIN PAGE LEVEL CSS STYLE ================== -->
{block name='custom_css'}{/block}
<!-- ================== END PAGE LEVEL CSS STYLE ================== -->
<!-- ================== BEGIN BASE JS ================== -->
<script src="{site_url()}assets/plugins/pace/pace.min.js"></script>
<!-- ================== …
Run Code Online (Sandbox Code Playgroud) 我昨天又发了一篇文章,并没有成功.我现在会尝试重新排序de idea并再次询问,因为我找不到解决方案(我是一个新手,我正在努力尝试).
问题是我正在使用基于Bootstrap的这个模板,这是我可以直接从其中一个文件中看到的代码,我在我的项目中使用的代码:
html片段:
<div class="hide" id="states">
<div class="control-group">
<label class="control-label">Seleccione</label>
<div class="controls">
<label class="checkbox span4">
<input type="checkbox" value="all" id="allstates" name="all"/>Todas
</label>
<label class="checkbox span4">
<input class="states" type="checkbox" value="Caba" id="" name="st[]"/>Ciudad Autónoma de Buenos Aires
</label>
<label class="checkbox span4">
<input class="states" type="checkbox" value="Buenos Aires" id="" name="st[]"/> Buenos Aires
</label>
<label class="checkbox span4">
<input class="states" type="checkbox" value="Catamarca" id="" name="st[]"/> Catamarca
</label>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
经过大量的搜索,我在检查时发现我的代码看起来像这样(片段):
<div class="controls">
<label class="checkbox span4">
<div class="checker" id="uniform-allstates">
<span>
<input type="checkbox" value="all" id="allstates" name="all"> …
Run Code Online (Sandbox Code Playgroud) 我正在研究一个jquery日期选择器.我需要选择一个日期,但是从日历中选择日期后,我需要将日期划分为三个单独的下拉菜单.一个月一个月,一个一个月.这是我的jquery脚本.
<script type="text/javascript">
$(document).ready(function() {
$(function() {
$( "#fullDate" ).datepicker({
onClose: function(dateText, inst) {
$('#day').val( dateText.split('/')[2] );
$('#month').val( dateText.split('/')[1] );
$('#year').val( dateText.split('/')[0] );
}
});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="demo">
<p>Date: <input id="fullDate" type="text" style="display:block"></p>
day:<select name="day" id="day" style="width:100px">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
month:<select name="month" id="month" style="width:100px">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
year:<select name="year" id="year" style="width:100px">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div><!-- End demo -->
Run Code Online (Sandbox Code Playgroud) 我是新用的postgresql,我已经使用Codeigniter一年了.
我有一个小的postgresql数据库,我想从Codeigniter调用它.
在我的database.php文件中,我有这个设置:
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => 'pgsql:host=localhost;port=5432;dbname=test;user=postgres;password=aPass',
// 'dsn' => '',
'hostname' => 'localhost',
'username' => 'postgres',
'password' => 'aPass',
'database' => 'test',
'dbdriver' => '',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
// 'port' => '5432'
);
Run Code Online (Sandbox Code Playgroud)
在控制器中我有这个功能:
public …
Run Code Online (Sandbox Code Playgroud) 我需要在Bootstrap模式下显示多个数据。为此,我要做的是:
js文件:
$('#seeProfile').on('show', function() {
$('.see-user').on('click', function(e) {
e.preventDefault();
var id = $(this).data('id');
$.ajax({
url: 'getUser',
type: 'POST',
data: {id: id},
success: function(html){
$('#seeProfile .modal-body .p').html('test');
},
error: function(){
alert("error");
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
查看摘要(模式):
<div id="seeProfile" class="modal hide fade" tabindex="-1" data-replace="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h3>Perfil de Usuario</h3>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
</div>
Run Code Online (Sandbox Code Playgroud)
这是行不通的。模态没有显示,但是检查时不会出现错误。我究竟做错了什么?
编辑
给定我已经意识到的答案,我错过了一个点,因此成功函数应该类似于:
$('#seeProfile .modal-body p').html("test");
Run Code Online (Sandbox Code Playgroud)
现在该模式正在工作,我需要知道如何将数据“插入”到这个新的模式组织中:
<div id="seeProfile" class="modal hide fade" tabindex="-1" data-replace="true">
<div class="modal-header"> …
Run Code Online (Sandbox Code Playgroud) 我一直在寻找官方文档,但我似乎无法把所有的东西放在我的脑海里(我是编程新手).我设法使用excel库并且它工作超级,但现在我想让用户有机会在.xls或.pdf中下载文件.
我正在使用Codeigniter和WAMP.
我下载了PHPExcel,它在我的C:目录下.
后来我将Classes:PHPExcel(文件夹)和PHPExcel.php复制到我的codeigniter的第三方文件夹中.
然后,在Codeigniter的Application,Libraries中,我创建了一个名为pdf.php的文件,并在那里复制了原始PHPExcel文档中的代码(21pdf.php)
pdf.php
/** PHPExcel_IOFactory */
require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
$rendererLibrary = 'tcPDF5.9';
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
if (!PHPExcel_Settings::setPdfRenderer(
$rendererName,
$rendererLibraryPath
)) {
die(
'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
EOL .
'at the top of this script as appropriate for your directory structure'
);
}
Run Code Online (Sandbox Code Playgroud)
我真的不知道如何配置它,我的脑子现在被烧了.任何帮助将非常感谢!
我有这个正则表达式在javascript验证:
/^(?:'[A-z](([\._\-][A-z0-9])|[A-z0-9])*[a-z0-9_]*')$/
Run Code Online (Sandbox Code Playgroud)
现在,我希望使用Codeigniter的表单验证进行表单验证的相同正则表达式:
$this->form_validation->set_rules('username', 'Nombre de usuario', 'required|min_length[2]|max_length[15]|regex_match[/^[A-Z a-z 0-9 _ . \-]+$/]|is_unique[user.username]');
Run Code Online (Sandbox Code Playgroud)
该行中的正则表达式与我提到的正则表达式不同.
当试图复制和粘贴相同的正则表达式时,它不起作用.我知道这是愚蠢的我似乎无法完全理解正则表达式.
html ×3
javascript ×3
jquery ×3
php ×3
codeigniter ×2
ajax ×1
checkbox ×1
database ×1
extends ×1
include ×1
pdf ×1
phpexcel ×1
postgresql ×1
regex ×1
smarty ×1
validation ×1