什么是“Drupal方式”做这个(页面中的动态内容)? [英] What's "the Drupal way" to do this (dynamic content in a Page)?
问题描述
目标:网站内容编辑器需要根据URL参数显示动态内容,即:
Objective: Site content editor needs to show dynamic content, based on a URL parameter, i.e.:
URL:
http://example.com/node/1?Name=John
在页面节点中:
<?php if (isset($_GET['Name'])) { ?>
<?php print "Dear " . $_GET['Name'] . ","; ?>
<?php } else { ?>
Hello,
<?php } ?>
blah blah blah ...
您可能会想像网址来自EDM消息内的链接。 EDM消息和页面内容都由相同的内容编辑器维护。
You may imagine the URL is from a link inside an EDM message. Both the EDM message and the Page content is maintained by the same content editor.
那么,Drupal方式是要存档的? / p>
So, what is the Drupal way to archive this?
推荐答案
您可以创建一个扩展令牌模块功能的模块,以允许使用各种_GET变量作为令牌身体。使令牌可用的代码不是什么大不了的,使用下面的令牌过滤器模块可以使编辑器使用节点体中的值变得简单。
You could create a module that extends the functionality of the token module to allow for the use of the various _GET variables as tokens in the body. The code to make the tokens available isn't a big deal, and using the token filter module below would make it simple for the editor to use the values in the node body.
http://drupal.org/project/token_filter
这篇关于什么是“Drupal方式”做这个(页面中的动态内容)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!