could i add some variables into the drupal node body?

﹥>﹥吖頭↗ 提交于 2019-12-11 12:12:40

问题


when i create an article useing the story type,could i add some variables into the body's textarea.then can invoke the variable and output it. thank you. the drupal version is 6.


回答1:


Inserting textual placeholders to be replaced by actual values on render is the purpose of the filters system in Drupal. Token filter provides, well, token replacement and is an handy tools if your need replacement for tokenized values. But there are plenty of filters for Drupal 6.x and you can even define your own in a custom module. The Custom filter can help for this. You can also use token filter and define your own token in your custom module.

A simple solution is to use the PHP filter but this is a insecure way of doing it. Also, putting PHP code in node (or any content) is a maintenance nightmare and a bad habits. You would be better doing it properly from the start.




回答2:


Contrib modules would be the way to go, unless you feel comfortable with PHP in which case you can just use the PHP filter. Depending on what variables you need you can try one of: http://drupal.org/project/InsertNode and http://drupal.org/project/token_filter

There are a couple of others (I like insert view) but they're currently not marked for production use.



来源:https://stackoverflow.com/questions/5138005/could-i-add-some-variables-into-the-drupal-node-body

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!