1

I would like to create the tx_news searchform on every page. So I try it to put it into the Layout:

<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>

The problem is, that {search} is not defined when there is no searchplugin on the site.

When there is a searchplugin {search} looks like this:

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

Am I somehow able to create this directly in the layout or what would be the best way to have the searchform on every page?

nbar
  • 6,028
  • 2
  • 24
  • 65

2 Answers2

1

You can use direct TS easy

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

    }
}
Oleg V Karun
  • 726
  • 1
  • 6
  • 29
0

Have you tried to insert the searchform via typoscript as records?

To do this, you should create the news plugin configured to search form somewhere in your pagetree, and reference it via ts like this:

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

This should do the trick.

mtness
  • 997
  • 9
  • 28
  • hi, thank you. I did it like this. I was hoping I can create it directly in the layout. As I have 2 environments - dev and live I don't have to worry about the right ID in typoscript when I copy files around. But I did not find a way. – nbar Jan 29 '15 at 12:31
  • Another possibility could be the integration via ts according to the docs: http://docs.typo3.org/typo3cms/extensions/news/Main/Tutorial/IntegrationWithTs/Index.html switchableControllerActions might be set to searchForm - but I never tested this, though. – mtness Jan 30 '15 at 14:17