1

我想在每个页面上创建 tx_news 搜索表单。所以我尝试将其放入布局中:

<div class="news-search-form">
            <f:form object="{search}" name="search" pageUid="{settings.searchPid}">
                <fieldset>

                        <f:form.textfield id="news-subject" property="subject" class="form-control"/>

                        <f:form.submit class="btn btn-default search-button"/>
                </fieldset>
            </f:form>
        </div>

问题是,{search}当网站上没有搜索插件时,它没有定义。

当有一个搜索插件{search}看起来像这样:

Tx_News_Domain_Model_Dto_Search (prototype transient entity)
   subject => NULL
   fields => NULL
   uid => NULL
   _localizedUid => NULL
   _languageUid => NULL
   pid => NULL

我是否能够以某种方式直接在布局中创建它,或者在每个页面上都有搜索表单的最佳方式是什么?

4

2 回答 2

1

您可以轻松使用直接 TS

lib.blogsearch = USER
lib.blogsearch{
    userFunc = tx_extbase_core_bootstrap->run
    extensionName = News
    pluginName = Pi1
    switchableControllerActions {
        News {
            1 = searchform
        }
    }
    settings < plugin.tx_news.settings
    settings {
        listPid = #you_id

    }
}
于 2015-04-16T13:58:30.510 回答
0

您是否尝试通过打字稿插入搜索表单作为记录?

为此,您应该创建配置为在页面树中某处搜索表单的新闻插件,并通过 ts 引用它,如下所示:

lib.searchform = RECORDS
lib.searchform {
    wrap = (whatever)|
    tables = tt_content
    source = {id of the searchform CE}
}

这应该可以解决问题。

于 2015-01-28T17:19:19.890 回答