Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-19 01:33:30

anthalus
New Member
Registered: 2013-02-19
Posts: 3

Duplicate search results and comment forms

Installed 4.5.4

When I use the search on my site, it displays the results in duplicate (or triplicate, depending on result numbers). Also, the comment form shows twice. I have used comment trace and can not figure out why this is happening. I am using the standard search result form (minus the html comments):

<txp:if_search>
    <txp:article limit="10" pgonly="1" />
    <txp:if_search_results>
        <txp:if_search_results max="200">
            <h3>
                <txp:search_result_count /> <txp:text item="matching_search_request" /> ‘<txp:search_term />’…
            </h3>
        <txp:else />
            <h3>
                <txp:text item="too_common_search_term" /> ‘<txp:search_term />’
            </h3>
        </txp:if_search_results>
    <txp:else />
        <h3>
            <txp:text item="no_search_matches" />
        </h3>
    </txp:if_search_results>
    <txp:article limit="10">
        <txp:if_first_article>
            <ul id="article-list">
        </txp:if_first_article>
                <li role="article" itemscope itemtype="http://schema.org/Article">
                    <h4 itemprop="name">
                        <a href="<txp:permlink />" itemprop="url">
                            <txp:title />
                        </a>
                    </h4>
                    <txp:if_excerpt>
                        <div itemprop="description">
                    <txp:excerpt />
                        </div>
                    <txp:else />
                        <p>
                            <txp:search_result_excerpt />
                        </p>
                    </txp:if_excerpt>
                    <p class="footnote"><txp:text item="posted" /> <time datetime="<txp:posted format='iso8601' />" itemprop="datePublished"><txp:posted /></time>, <txp:text item="author" /> <span itemprop="author"><txp:author link="1" this_section="1" /></span></p>
                </li>
                <txp:if_last_article>
            </ul>
        </txp:if_last_article>
    </txp:article>
    <txp:if_search_results min="11">
        <p id="paginator">
            <txp:variable name="prev" value='<txp:older />' />
            <txp:variable name="next" value='<txp:newer />' />
            <txp:if_variable name="next" value="">
                <span id="paginator-l" class="button disabled">← <txp:text item="prev" /></span>
            <txp:else />
                <a id="paginator-l" href="<txp:newer />" title="← <txp:text item="prev" />" class="button">← <txp:text item="prev" /></a>
            </txp:if_variable>
            <txp:if_variable name="prev" value="">
                <span id="paginator-r" class="button disabled"><txp:text item="next" /> →</span>
            <txp:else />
                <a id="paginator-r" href="<txp:older />" title="<txp:text item="next" /> →" class="button"><txp:text item="next" /> →</a>
            </txp:if_variable>
        </p>
    </txp:if_search_results>
</txp:if_search>

The comment form is the standard one as well. All I’ve done is applied CSS to it, which should not affect it duplicating itself.

Offline

#2 2013-02-19 08:07:26

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,547
Website GitHub Twitter

Re: Duplicate search results and comment forms

Yes i had the same problem!

the search_result form look queer! there is a txp:article inside it! i dont know if this logical!

But to solve this you take the search_result form content and put it directly into the page at the place where search result must be shown and that solve the problem!

Offline

#3 2013-02-19 10:17:31

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Duplicate search results and comment forms

The code was taken from this example in the Textpattern manual

Having looked at my latest version of this form in the GitHub repo I removed the <txp:if_search> tag from it a while back (because that tag is already in the page template that calls the form) so maybe that is the problem above?

I can’t replicate the problem you’re having, so maybe try removing that tag (and it’s closing tag). Let me know.

Offline

#4 2013-02-21 02:09:44

anthalus
New Member
Registered: 2013-02-19
Posts: 3

Re: Duplicate search results and comment forms

philwareham wrote:

The code was taken from this example in the Textpattern manual

Having looked at my latest version of this form in the GitHub repo I removed the <txp:if_search> tag from it a while back (because that tag is already in the page template that calls the form) so maybe that is the problem above?

I can’t replicate the problem you’re having, so maybe try removing that tag (and it’s closing tag). Let me know.

I tried your github version, and it still does triplicate: http://www.anthalus.com/?q=php

No clue what is going on. Perhaps its a bug? Maybe search only works if it has a dedicated section/page?

Still no idea why the comment form shows in duplicate (currently turned off on my site)?

Offline

#5 2013-02-21 23:40:55

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,391
Website

Re: Duplicate search results and comment forms

anthalus wrote:

No clue what is going on. Perhaps its a bug? Maybe search only works if it has a dedicated section/page?

Still no idea why the comment form shows in duplicate (currently turned off on my site)?

Not sure what is going on with your search results – how is that integrated into your page template ? I normally use a dedicated search section, but I just tested on default installs of both TXP 4.5 and 4.6pre, and both work as expected.

As for the duplicated comments, what is the setting for ‘Automatically append comments to articles?’ in Admin > Preferences. It should be set to ‘no’ probably.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#6 2013-02-22 01:09:55

anthalus
New Member
Registered: 2013-02-19
Posts: 3

Re: Duplicate search results and comment forms

Perhaps its a Linux issue? I tried TXP 4.4 and 4.5 and it works fine. But for some reason, it doesn’t installed on my host. I am going to make a dedicated section for search and see if this fixes it. Another thought I had is maybe there is not enough populated in the database so the code is colliding with itself?

Turning off the “Automatically append” fixed the comment issue! Such a strange “feature”…

Last edited by anthalus (2013-02-22 01:12:02)

Offline

#7 2013-10-24 19:30:05

tomt
New Member
Registered: 2013-10-24
Posts: 3

Re: Duplicate search results and comment forms

Hi,

anthalus wrote:

Perhaps its a Linux issue? I tried TXP 4.4 and 4.5 and it works fine. But for some reason, it doesn’t installed on my host. I am going to make a dedicated section for search and see if this fixes it. Another thought I had is maybe there is not enough populated in the database so the code is colliding with itself?

I had a problem on Windows7 where comments appeared three times, so it is not OS specific.

Turning off the “Automatically append” fixed the comment issue! Such a strange “feature”…

The solution also worked – only one comment appears if this option is not checked, three if it is – so perhaps you should highlight it somewhere (say in the problem-solving section), as it took way to long to find this solution for something obvious and ugly. Otherwise liking this software so far (2 hours).

Using the nightly build 4.6-dev downloaded 2013-10-24.

Offline

#8 2013-10-24 21:42:30

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Duplicate search results and comment forms

If it was up to me, that option wouldn’t even be in Textpattern any more, but it has to stay for backwards compatibility I believe.

Offline

Board footer

Powered by FluxBB