我有一个针对wordpress的搜索表单(在另一个php文件中)
function search_form {
echo '<form>code</form>';
}
$search_form = search_form();
我想要这个:
if('true' == $instance['example'] )
echo '<div>' . $search_form . '</div>';
我怎么能这样做,因为上面的例子不起作用。
答案 0 :(得分:2)
function search_form {
return '<form>code</form>';
}
$search_form = search_form();
使用return
代替echo
答案 1 :(得分:-1)
使用app.controller('SessionsCtrl', function($scope, $state, Auth, sessions){
$scope.sessions = sessions; // data is available since injected by router
console.log($scope.sessions); // logs the appropriate data
$scope.submitSession = function() {
$scope.sessions.$add({ title: 'new session' });
};
});
在变量中获取搜索表单。
示例:
$form = get_search_form(false)
详细了解get_search_form here