Brand new to Drupal and one thing that hopefully I can change is that it seems I have give up using vim and other development tools because of the way code is stored in a backend DB. Without a powerful editor like vim and being able to navigate code on a normal filesystem, I'm crippled.

Am I missing something or is it the Drupal way to have to edit code through the edit link via a web browser?

Thanks,
Brandon

Comments

vm’s picture

I believe you would use vim if you wanted to work within drupal files. ie: tpl.php files and if you were into creating custom modules and the like.

Drupal content is edited through the drupal interfaces.

bwm71’s picture

That's what I was afraid of. Unless one is doing basic editing, it seems this is really limited. What if I want to do something as simple as search for and replace a string using the Drupal interface?

vm’s picture

Then you use the locale.module (part of core) or the string overrides.module in contrib.

Drupal is designed in such a way that you should never have to alter drupal core files or module files. You plug into them using hooks.

The content itself is stored in the database. In other words, what I am typing right now, will be saved to the database once I hit the post comment button.

StefanT’s picture

This is a question only silly people thinking an editor that was modern in the 1960's is the same as a webbrowser would ask.

bwm71’s picture

I don't think that's a fair comment. Vi/Vim (or pick your favorite editor, say, Emacs) are very much in use today and are very powerful. I have a strong UNIX background and these editors are what work for me. My point is still valid for any editor. I realize the difference between these editors and a web browser. And for what it's worth, I didn't start using UNIX and Linux until the early 90s.

yelvington’s picture

Sounds like you are confused. The whole point of a content management system is to keep content, business logic and presentation neatly separated. Drupal does not, in general, store code in a database. It stores data in the database. Code is in module (business logic) and template (presentation) files, and you should not need to touch them unless you are making fundamental changes in design and/or functionality. For those files, vi is a usable editor.

bwm71’s picture

I guess I misstated what I meant by code. For example, if I want to create a new web page that is displayed in Drupal I can use HTML to author the page. It's the HTML that I was referring to as code. It seems I can't use an editor of choice to work up this HTML.

vm’s picture

You can use any editor you want that builds HTML pages. However, you need to ensure that the proper lines of PHP are also put in your HTML.

Provided that the files you create are somefile.tpl.php and use the correct naming conventions you will be fine.

Keep in mind Drupal is not static HTML it uses a blend in the tpl.php files.

Now, the above is simply for template files. If you want to use HTML inside a node that doesn't affect the theme of drupal in any way then that's a different animal and yes an HTML editor won't work in this case unless you cut and paste the code generated from the editor leaving out all of the non necessities. ie HTML tag head tag body tag so on so forth that is already being rendered by drupal's page.tpl.php file.

bwm71’s picture

Yes, it's HTML inside of a node that I'm referring to. I inherited this site and a lot of nodes are HTML forms calling PHP code. Of course, I can use Vim, for example, to code up the backend PHP, but was hoping I could do the same for the node itself.

This begs another question, is using Drupal in this manner an abuse of its design. That is, using forms in nodes. Is there a better way to achieve this in Drupal?

WorldFallz’s picture

Yes there is. For forms that you wish to create nodes (that is, store the data in the db), you can use the cck module and any of the available form element field types. For simple forms, where you do not want to create nodes, see the webform module.

If neither of those meet your requirements, there's an extensive drupal formapi that is responsible for creating forms in drupal:

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

vm’s picture

anything stored in a node is subsequently stored in the database and not in a file. Therefore an editor (any editor) really won't help in this type of situation.

cyrus-2’s picture

You can use vim`s scripting support for that