我需要将jQuery和其他javascript文件添加到我的Zend Framework项目中.我正在尝试使用Action控制器: -
public function userinfoAction()
{
$this->view->headScript()->appendFile($basePath .'/js/validate_jquary.js');
$this->headScript()->appendFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
return new ViewModel();
}
Run Code Online (Sandbox Code Playgroud)
但它没有用.
我需要追加 - 到目前的文本框值而不替换当前文本.我试过这个代码.
if(len.length==4){
$("-").appendTo("#date").val();
}
Run Code Online (Sandbox Code Playgroud)
但它失败了.
我正在创建php前端控制器.这是我的.htaccess档案.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) controller.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
此代码将所有网址重定向到controller.php.我需要避免重定向index.php到controller.php.所有其他网址应重定向到controller.php.
我尝试使用nsIProcess执行.exe文件.但它没有工作,也没有给出任何错误信息.我正在使用firefox 10和Windows 7.任何人都可以建议我解决方案吗?谢谢
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIProcess);
file.initWithPath("C:\\Users\MJ\\Desktop\\Example.FaceDetection.exe");
file.launch();
Run Code Online (Sandbox Code Playgroud) 我使用下面的代码在控制器动作中呈现页面.
public function userinforeceiveAction()
{
$renderer = new PhpRenderer();
$map = new Resolver\TemplateMapResolver(array(
'userinfo' => __DIR__ . '/userinfo.phtml',
));
$resolver = new Resolver\TemplateMapResolver($map);
$renderer->setResolver($resolver);
$model = new ViewModel();
$model->setTemplate('userinfo');
return new ViewModel();
}
Run Code Online (Sandbox Code Playgroud)
我在视图中回显渲染内容.
echo $renderer->render($model);
Run Code Online (Sandbox Code Playgroud)
但它什么都没有.请帮我.谢谢.并且通过这两行与zf1的精细工作.
$this->userinfoAction();
$this->$render('userinfo');
Run Code Online (Sandbox Code Playgroud) 我有两个班级空着色.一旦我点击了彩色类,然后删除彩色类并添加空类.我再次点击它应该添加彩色类和remoce空类.但它没有用.
var color_click = false;
var select_color = "";
$( ".colored").on('click',function(e){
if(color_click != true){
color_click = true;
select_color = $(this).css('background-color');
$(this).removeClass("colored");
$(this).addClass( "empty");
$(this).css('background-color','')
}
});
$( ".empty").click(function(){
if(color_click == true){
color_click = false;
$(this).css('background-color',select_color);
$(this).addClass("colored");
$(this).removeClass( "empty");
}
});
Run Code Online (Sandbox Code Playgroud) 我使用查询字符串做了前端控制器.
例如:
但是我需要在不使用查询字符串的情况下完成它.
jquery ×3
php ×3
.htaccess ×2
javascript ×2
addclass ×1
apache ×1
firefox ×1
removeclass ×1
validation ×1