简体   繁体   English

Drupal6-页面调试

[英]Drupal6 - Debug on the page

Hi 你好
I am going to change the template file (page.tpl.php), I need to write the code on this file, then upload to server, after that refresh the browser to see the result. 我要更改模板文件(page.tpl.php),我需要在该文件上编写代码,然后上传到服务器,然后刷新浏览器以查看结果。

Is there any other way to do this thing conveniently? 还有其他方法可以方便地执行此操作吗?

大多数人在本地计算机上设置测试服务器,以便他们可以直接对其进行编辑,然后在完成后将其上传到真实服务器。

If you are using Ubuntu (or any modern Gnome or KDE-based linux-system) you can very easily "mount" remote servers over FTP or SSH (or a range of other protocols). 如果您使用的是Ubuntu(或任何现代的Gnome或基于KDE的现代linux系统),则可以非常容易地通过FTP或SSH(或一系列其他协议)“挂载”远程服务器。

That allows you to work directly on remote: open files with any editor, save it, as if it were a local file and so on. 这样一来,您就可以直接在远程上工作:使用任何编辑器打开文件,将其保存为本地文件,依此类推。

http://blog.ashfame.com/2011/01/connect-ftp-server-ubuntu-without-client/ http://blog.ashfame.com/2011/01/connect-ftp-server-ubuntu-without-client/

That is a good way to develop, if your development environment is set up remote. 如果您的开发环境是远程设置的,那是开发的一种好方法。 However, developing on your live environment is generally a bad idea: 但是,在您的生活环境中进行开发通常不是一个好主意:

  • It opens up security issues: the unfinished, unhardened environment is accessible to anyone. 它带来了安全性问题:任何人都可以访问未完成,未强化的环境。 Just leave some development-module on and your server could de taken over, for instance. 只需保留一些开发模块,例如您的服务器就可以被接管。
  • It is cumbersome: a local development-environment allows for much more convenience addons, such as verbose logging, debug-addons and so on. 这很麻烦:本地开发环境允许更多方便的附加组件,例如详细的日志记录,调试附加组件等。
  • It is (near) impossible to cleanly continue development after deployment (putting live), since you will be debugging amongst your visitors: giving them errors, breaking their accounts, and so on. 在部署(投入使用)之后,完全(几乎)不可能继续进行开发,因为您将在访问者中进行调试:给他们带来错误,破坏他们的帐户等。

I suggest you to setup a local development server using the *AMP stack ( LAMP for linux, MAMP for Mac OS or XAMPP for Windows ) server, so that you are able to quickly edit and test files. 建议您使用* AMP堆栈(Linux的LAMP ,Mac OS的MAMP或Windows的XAMPP )服务器设置本地开发服务器,以便能够快速编辑和测试文件。
Also usually is not advised to directly develop on a production system, as you could produce service downtime due to your developing. 通常也不建议直接在生产系统上进行开发,因为开发可能会导致服务中断。

Some useful resources you can find are: 您可以找到一些有用的资源:

  • Quickstart: Prebuilt Drupal Development Environment : 快速入门:预先构建的Drupal开发环境
    Virtualbox instance ready to be used to develop Drupal applications 准备用来开发Drupal应用程序的Virtualbox实例
  • Drupal Devel Module a module which enables a set of handful functions to debug and print on screen custom and drupal variables; Drupal Devel模块是一个模块,该模块使一组少数功能可以在屏幕上自定义和Drupal变量进行调试和打印; have a look at the documentation, which is full of information 看一下文档,里面有很多信息
  • Devel Themer while developing a theme this module is extremely useful; devel的Themer同时制定一个主题此模块是非常有用的; again, look at the docs for a complete overview 再次,查看文档以获取完整概述
  • File logger is a module that allows developers to configure a log file from within Drupal and dump variables to it from within a running Drupal app 文件记录器是允许开发人员从Drupal内部配置日志文件并将变量从正在运行的Drupal应用程序中转储到该文件的模块
  • How do I debug Drupal? 如何调试Drupal? a similar question posted on StackExchange Drupal Answer, with lot of resources for debugging Drupal and/or PHP applications. StackExchange Drupal Answer上发布了一个类似的问题,其中包含用于调试Drupal和/或PHP应用程序的大量资源。

After development you could use a tool like scp or Filezilla ( for FTP ) to upload your file to the server. 开发之后,您可以使用诸如scpFilezilla (用于FTP)之类的工具将文件上传到服务器。

Happy coding! 编码愉快! :) :)

On Windows Xampp is a good choice: http://www.apachefriends.org/de/xampp.html 在Windows上,Xampp是一个不错的选择: http : //www.apachefriends.org/de/xampp.html

Please note if you are on 64bit Windows machine you cannot debug. 请注意,如果您使用的是64位Windows计算机,则无法调试。 Xdebug nor ZendDebugger are working with the any of the xampp versions. Xdebug或ZendDebugger都可以使用任何xampp版本。

See also the Drupal for Firebug extension - https://addons.mozilla.org/en-US/firefox/addon/drupal-for-firebug/ - to use this, you must also install the Drupal module on your Drupal site, from the source linked there. 又见Drupal的Firebug的扩展- https://addons.mozilla.org/en-US/firefox/addon/drupal-for-firebug/ -使用这个,你还必须在您的Drupal站点安装Drupal的模块,从源链接在那里。 This will give you easy access to the content of variables by simply including in the template file (between PHP tags) firep($myvar); 只需在模板文件中(PHP标记之间) firep($myvar); ,即可轻松访问变量的内容firep($myvar);

This will add to the convenience - the variable dump won't be in the middle of a lot of HTML, sometimes obscured - but will be nice, cleanly displayed in the Firebug panel at the bottom of your browser. 这将增加便利性-变量转储不会出现在很多HTML的中间,有时甚至会被遮盖住-但是会很好,干净地显示在浏览器底部的Firebug面板中。

If you have shell access to the server, you can edit the file via vi or emacs. 如果您具有对服务器的Shell访问权限,则可以通过vi或emacs编辑文件。 If you do not have shell access, there are text editors out there that can treat remote files like they are local. 如果您没有外壳访问权限,则可以使用文本编辑器将远程​​文件视为本地文件。 My personal favorite is Ultraedit . 我个人最喜欢的是Ultraedit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM