Google Search

Google Search 1.1.0

No permission to download
When you try to rename any phrase in Russian, it gives errors.
При попытке переименовать любую фразу на Русский, выдает ошибки.
 
What is the error?

Code:
ErrorException: [E_WARNING] mkdir(): Permission denied in src/XF/Util/File.php at line 281
XF::handlePhpError()
mkdir() in src/XF/Util/File.php at line 281
XF\Util\File::createDirectory() in src/XF/Util/File.php at line 303
XF\Util\File::writeFile() in src/XF/DevelopmentOutput.php at line 546
XF\DevelopmentOutput->writeFile() in src/XF/DevelopmentOutput/Phrase.php at line 28
XF\DevelopmentOutput\Phrase->export() in src/XF/DevelopmentOutput.php at line 53
XF\DevelopmentOutput->export() in src/XF/Behavior/DevOutputWritable.php at line 37
XF\Behavior\DevOutputWritable->postSave() in src/XF/Mvc/Entity/Entity.php at line 1211
XF\Mvc\Entity\Entity->save() in src/XF/Mvc/FormAction.php at line 69
XF\Mvc\FormAction->XF\Mvc\{closure}() in src/XF/Mvc/FormAction.php at line 187
XF\Mvc\FormAction->run() in src/XF/Admin/Controller/Phrase.php at line 128
XF\Admin\Controller\Phrase->actionSave() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
XF\App->run() in src/XF.php at line 390
XF::runApp() in admin.php at line 13
 
Is there any template code tweak needed for this to work on a custom style?

I can't get the Google Search option to show in the header. However it does work on the Xenforo native style so obviously there's a disconnect caused by the style.

205030

I'm using a style from PixelExit and their XenBase platform. Their template that does the search duty is xb_search.

Code:
<xf:macro name="xb_search_macro" arg-searchConstraints="!">
<xf:if is="$xf.visitor.canSearch()">

    <div class="xb-searchWrapper">
        <div class="xb-search--field">
            <xf:textbox name="keywords"
                        placeholder="{{ phrase('search...') }}"
                        aria-label="{{ phrase('search') }}"
                        form="xbSearch"
                        data-menu-autofocus="true" />
        </div>
        <div class="xb-search--submit">
            <button type="submit" form="xbSearch">
                <xf:fa icon="fa-search" data-xf-init="tooltip" title="{{ phrase('search') }}" />
            </button>
        </div>
        <div class="xb-search--advance">
            <xf:fa icon="fa-cog"
               data-xf-click="menu"
               aria-label="{{ phrase('search') }}"
               aria-expanded="false"
               data-xf-init="tooltip"
               title="{{ phrase('more_options')}}"
               aria-haspopup="true" />
            <div class="menu menu--structural" data-menu="menu" aria-hidden="true">
                <div class="menu-content">
                    <form action="{{ link('search/search') }}" id="xbSearch" class="xb-search" method="post" data-no-auto-focus="true">
                    <xf:if is="$searchConstraints">
                    <div class="menu-row">
                    <xf:select name="constraints"
                        class="js-quickSearch-constraint"
                        aria-label="{{ phrase('search_within') }}">

                        <xf:option value="">{{ phrase('everywhere') }}</xf:option>
                        <xf:foreach loop="$searchConstraints" key="$constraintName" value="$constraint">
                            <xf:option value="{$constraint|json}">{$constraintName}</xf:option>
                        </xf:foreach>
                    </xf:select>
                        </div>
                    </xf:if>
                   
                    <!--[XF:search_menu:above_title_only]-->
                    <div class="menu-row">
                        <xf:checkbox standalone="true"><xf:option name="c[title_only]" label="{{ phrase('search_titles_only') }}" /></xf:checkbox>
                    </div>
                    <!--[XF:search_menu:above_member]-->
                    <div class="menu-row">
                        <div class="inputGroup">
                            <span class="inputGroup-text">{{ phrase('by:') }}</span>
                            <input class="input" name="c[users]" data-xf-init="auto-complete" placeholder="{{ phrase('member') }}" />
                        </div>
                    </div>
                    <div class="menu-footer">
                        <span class="menu-footer-controls">
                            <xf:button type="submit" class="button--primary" icon="search" />
                            <xf:button href="{{ link('search') }}" rel="nofollow">{{ phrase('advanced_search...') }}</xf:button>
                        </span>
                    </div>

                    <xf:csrf />
                    </form>
                </div>
               
            </div>
               
        </div>
    </div>

</xf:if>
</xf:macro>
 
Last edited:
Great work on the add-on! This works with 'AdSense for Search', if you want to show your own ads for Google in the search results.

How do you make Google the default search tab and XenForo's default search secondary?

Edit: Why is there a VK logo shown in the search results? :rolleyes:

hxNZtzE.png
 
Last edited:
When doing some custom work in XenForo I found a small issue associated with the code in this add-on.

The PAGE_CONTAINER template modification causes the HTML to invalidate (per W3C). Basically it puts a <div> inside of an existing <span>.

It appears if you just change the <div> out to <span>, it will work and validates since <span> is allowed within another <span>:
HTML:
<div class="buttonGroup">
    $0
    <xf:button type="submit"
               formaction="{{ link('google-search') }}"
               data-xf-init="tooltip"
               title="{{ phrase('CMTV_GoogleSearch_search_using_google') }}"
               class="button--primary google-search-button"
               icon="fab fa-google"
               style="min-width: 40px;">
            <xf:fa icon="fab fa-google" />
    </xf:button>
</div>
to
HTML:
<span class="buttonGroup">
    $0
    <xf:button type="submit"
               formaction="{{ link('google-search') }}"
               data-xf-init="tooltip"
               title="{{ phrase('CMTV_GoogleSearch_search_using_google') }}"
               class="button--primary google-search-button"
               icon="fab fa-google"
               style="min-width: 40px;">
            <xf:fa icon="fab fa-google" />
    </xf:button>
</span>
 
Is it possible to disable the default XenForo search system and make this add-on (Google search) the default?
 
Top Bottom