我习惯在.html
文件中进行zen编码,它可以正常工作!但我无法弄清楚如何在.php
文件中执行相同操作,尝试 ctrl + alt + 输入但是没有发生了。我正在使用Joomla网站,因此主题文件将位于.php
而不是.html
,但是要输入的HTML标签太多了。我甚至尝试在zen-coding.sublime.settings
中添加此设置并将其保存在用户文件夹中但没有任何反应。为什么它不起作用?这是我从link获得引用的地方,但它在Zen Coding.js中使用,但即使在ST2中语法也是相同的。片段只是其他设置,但主要的是HTML zen编码缩写不会出现在.php
文件中,而是在.html
中。任何人都可以解决这个问题吗?
"my_zen_settings" : {
"html": {
"filters": "php,html",
"abbreviations": {
"jq": "<script src='jquery.js' type='javascript'>",
"demo": "<div id=\"demo\"></div>"
}
},
"css": {
"filters": "html,css,fc",
"snippets": {
"c": "color:#${1:000000};"
}
},
"php": {
"filters": "php,html",
"snippets": {
"php": "<?php | ?>",
"php:info": "<?php\nphpinfo();\n?>",
"php:echo": "<?php echo | ?>",
"php:Ns": "<?php\nnamespace |;\n\t\n?>",
"php:ns": "namespace |;",
"php:Class": "<?php\nclass |\n{\n\t\n}\n?>",
"php:class": "class |\n{\n\t\n}",
"php:Function": "<?php\nfunction |() {\n\t\n}\n?>",
"php:function": "function |() {\n\t\n}",
"php:Var": "<?php $| = ; ?>",
"php:var": "$| = ;",
"php:Object": "<?php $| = (object) ; ?>",
"php:object": "$| = (object) ;",
"php:New": "<?php $| = new ; ?>",
"php:new": "$| = new ;",
"php:Bool": "<?php $| = FALSE; ?>",
"php:bool": "$| = FALSE;",
"php:Array": "<?php $| = array(); ?>",
"php:array": "$| = array();",
"php:Array+": "<?php |[] = ; ?>",
"php:array+": "|[] = ;",
"php:Array-": "<?php unset($|[]); ?>",
"php:array-": "unset($|[]);",
//hack $|, seems to replace $i with $1
"php:For": "<?php\nfor ($|i = 0; $|i < |; $|i++) {\n\t\n}\n?>",
"php:for": "for ($|i = 0; $|i < |; $|i++) {\n\t\n}",
"php:Foreach": "<?php\nforeach (| as ) {\n\t\n}\n?>",
"php:foreach": "foreach (| as ) {\n\t\n}",
"php:While": "<?php\nwhile(|) {\n\t\n}\n?>",
"php:while": "while(|) {\n\t\n}",
"php:Dowhile": "<?php\ndo {\n\t\n} while(|);\n?>",
"php:dowhile": "do {\n\t\n} while(|);",
"php:If": "<?php if( | ) { ?>\n\t\n<?php }?>",
"php:if": "if( | ) {\n\t\n}",
"php:Ifelse": "<?php if( | ) { ?>\n\t\n<?php } else { ?>\n\t\n<?php }?>",
"php:ifelse": "if( | ) {\n\t\n} else {\n\t\n}",
"php:Switch": "<?php switch( | ) { \n\tcase :\n\t\t\n\t\tbreak;\n\tdefault :\n\t\t\n\t\tbreak;\n}\n?>",
"php:switch": "switch( | ) { \n\tcase :\n\t\t\n\t\tbreak;\n\tdefault :\n\t\t\n\t\tbreak;\n}",
"php:Include": "<?php include \"|\"; ?>",
"php:include": "include \"|\";",
"php:Include1": "<?php include_once \"|\"; ?>",
"php:include1": "include_once \"|\";"
}
}
}
答案 0 :(得分:3)
有同样的问题。尝试以下方法:
这似乎可以解决问题。我希望这会有所帮助。
答案 1 :(得分:1)
您可以为Sublime Text 2安装Emmet: https://github.com/sergeche/emmet-sublime
注意: Emmet(前禅编码)。
答案 2 :(得分:0)
将text.php添加到Default(Windows).sublime-keymap为我工作。