简体   繁体   English

PHP,HTML,Drupal 7变量

[英]PHP, HTML, Drupal 7 variable

I have html code and would like to insert a node title into it (juste at the "label" place), so this is what i have done: 我有html代码,并希望在其中插入一个节点标题(juste在“标签”处),所以这就是我所做的:

<?php
$nid = 4;
$node = node_load($nid);
$title = $node->title;
?>

var node = 
{
label : $title
};

But it doesn't show up in drupal. 但它并没有出现在drupal中。 Have I done something wrong? 我做错了什么吗?

Thank you, 谢谢,

Jamie 杰米

看起来你正在尝试将php变量打印成HTML,在这种情况下你需要将它包含在php标签中并使用print函数,如下所示:

<?php print $title; ?>

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

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