我正在编写一个PHP脚本,它为我的模板分配一些html代码。
PHP-文件:
$smarty->assign("PLACEHOLDER", getCode());
$smarty->display('index.html');
function getCode(){
return "{literal}some code which I want to get evaluated ...{/literal}";
}
HTML-文件:
{$PLACEHOLDER}
我知道我可以使用{eval var=$PLACEHO
我试图使用名为name的变量通过smarty运行条件语句,但是在运行php文件时不会显示任何内容。我是smarty的新手。我所犯的错误是什么?
Test.php
<?php
require_once('./libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->assign('title','Title of the page');
$smarty->assign('hello','Text displayed
我有一个视图显示了很多任务。该任务是一种内容类型,其字段之一是对称为主题的分类法的引用。分类法主题有一个字段,该字段引用另一个名为分区的分类法。分区分类法有包含颜色的字段。我想将视图标题的背景更改为分区的颜色。因为我是个初学者,我不知道如何做到这一点。我只能从重写我的视图模板开始。但我不能加载分类学术语。
/* views-view-unformatted--aufgaben.tpl.php
View reference field as a RELATIONSHIP:"field_task_themen" from taxonomy "Theme".
我正在寻找一些帮助,以创建一个非常简单的形式,在一个智能模板,但我不熟悉如何做到这一点。
该表格计算出客户需要多少升产品才能覆盖X平方米。
<form action="/calc.php" method="post">
<h4>How much area would you like to cover?</h4>
<input type="number" name="area" min="1"> m<sup>2</sup>&l
我正在构建一个小型MVC应用程序,我想提供从基本模板(即父模板)继承的网页。因此,我创建了一个View.php类来初始化模板:
<?php
class View {
protected $path = $_SERVER['DOCUMENT_ROOT'] . "views/";
protected $data;
public function __construct() { $this->data = array(); }
public function render($view) {
if (
我有这个函数可以从.html文件夹中调用带有扩展的模板,因为我想将html与php分开
好的,这是我调用模板的函数。
class Template {
public $temp;
// function for reading the template from a directory
function gettemplate($template) {
// check if path is folder
if (is_dir('templates/')) {
// check if file exists and if is reada
我正在创建一个基于WordPress的选项面板
在本文中,它声明调用存储的选项来使用
//get the data to an array
$data = get_option('demo_options');
//access each field by its id
echo $data['text_field_id'];
这是可行的,唯一的问题是,如果我想调用一些信息,比如header.php和footer.php,或者任何其他页面,我必须包括行
$data = get_option('demo_options');
在每个页面的顶部,否则