Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Troubleshooting
  3. » PHP Fun

#1 2026-02-04 23:33:44

imazer
Member
Registered: 2024-06-19
Posts: 17

PHP Fun

So I upgraded to 4.90 and thought I’d done due diligence. When login onto my site I get the setup menu, put in the appropriate data (some was already populated), noted that I already had a database setup. Then on to the next window which said I was connected, but rendered this warning:

“It appears the tables in [deleted]_textpattern already exist. If you wish to continue setup, either delete the existing tables, or choose a different table prefix”

Um…what? I just told the system I had an existing database on the previous pop-up window. And my existing config.php agrees with all my inputs. Anyone have suggestions?

Thanks!

Offline

#2 2026-02-04 23:53:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,446
Website GitHub

Re: PHP Fun

If you upgrade from a previous instance you most certainly do NOT want to go through /setup! That can erase your site and start fresh if you’re not careful. The warnings you encountered are there to protect your data :)

There’s an upgrade.md file in the distro that explains in detail what you should do, but the crux of it is:

  1. log out of Txp
  2. take a backup of the DB and filesystem
  3. transfer most of the new /textpattern directory, /themes (if it doesn’t exist), /rpc (if you use it) plus index.php and css.php. Also upload .htaccess if you haven’t made any modifications to your original (assuming you’re using Apache).
    1. be careful to exclude the /textpattern/setup directory and that you don’t accidentally overwrite your /textpattern/plugins directory. And that your original config.php remains intact.
  4. log back into your admin side. The upgrade script will complete.
  5. profit

Last edited by Bloke (2026-02-05 00:17:16)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#3 2026-02-05 15:57:35

imazer
Member
Registered: 2024-06-19
Posts: 17

Re: PHP Fun

Thank you for your quick response, Bloke.

I removed the setup directory and the config.php is there. However, when I now try login in get this:

“config.php is missing or corrupt. To install Textpattern, ensure textpattern/setup/ exists.”

Nonsense.

OK, now that I look at my server files via plesk, I can see my file structure may be borked. I somehow have two instances of Textpattern, one nested inside the other. Along side the “outer” Textpattern directory are other files and directories containing current items, including my config.php. There is a duplicate index.php in the “inner” textpattern directory.

Everything was backed up before the upgrade. I need a clear picture of a finished, proper installation to determine what goes where. I may have to erase all the relevant files/directories and start with a fresh install of Textpattern 4.90, adding saved items as I go along.

Offline

#4 2026-02-05 17:05:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,446
Website GitHub

Re: PHP Fun

Sounds like your upload didn’t quite go according to plan. So this is the structure you should see under your site root (often called httpdocs):

.htaccess
css.php
index.php
files/
images/
rpc/ [optional]
textpattern/ [includes config.php]
themes/

That’s about it. You shouldn’t need to start again. Just upload the 4.9.0 files over the top of the ones already there (delete the duplicate nested textpattern directory) being careful to preserve config.php, the textpattern/plugins directory, and to exclude or delete textpattern/setup.

Then log in to your admin side and the upgrade will complete.

Last edited by Bloke (2026-02-05 17:07:25)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#5 2026-02-05 21:25:12

imazer
Member
Registered: 2024-06-19
Posts: 17

Re: PHP Fun

Success!

Followed your advice and things cleaned up nicely. Diagnostics was fine.

And the website works as expected — with one exception, my search page fuction failed to populate even terms that should obviously pull up results, so I’ll check the Forms, et. al. about that.

Thank you, thank you! That was nerve-wracking, but fun.

Offline

#6 2026-02-05 21:54:15

imazer
Member
Registered: 2024-06-19
Posts: 17

Re: PHP Fun

Oh, and perhaps I should put this comment elsewhere, but in the Textpattern 4.90 my in-article thumbnail images no longer expand when the pop-up occurs, they stay thumbnail size in the pop-up.

Offline

#7 2026-02-05 21:57:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,446
Website GitHub

Re: PHP Fun

Glad you got the site working.

If you could please post the relevant portions of your code for the search and thumbnail rendering here, we’ll try to figure out what’s going on.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#8 Yesterday 17:48:27

imazer
Member
Registered: 2024-06-19
Posts: 17

Re: PHP Fun

Here you go:

HTML:

<pre><code>

<!---search area--->



        <form>
        <txp:search_input form="custom_search_form" />
        </form>




<!---search results area--->


        <div id="search-results-container" >

          <txp:if_search>
          <txp:article limit="99" pgonly="1" />
          <txp:if_search_results>
          <p style="color: red;">Search results: <txp:search_result_count /></p>
          <txp:article limit="99">
          <h3 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h3>
          <p class="published"><txp:posted /></p>
          <p class="entry-summary"><txp:search_result_excerpt /></p>
          <p class="small"><txp:permlink><txp:permlink /></txp:permlink></p>
          <div class="divider"><txp:output_form form="svg_divider" /></div>
          </txp:article>
          <txp:else />
          <p>nothing found <strong><txp:search_term /></strong>.</p>
          </txp:if_search_results>
          <txp:else />
          <txp:if_section name=" ,uudised">
          <txp:article status="sticky" />
          <txp:article limit="3" />
          <txp:newer />
          <txp:older />
          </txp:if_section>
          </txp:if_search>

         </div>

<pre><code>
========================

CSS:

#searchbar-box  {
    position: absolute;
    top: 10%;
    flex: 0;
    word-break: keep-all;
    font-family: Georgia;
    font-size: clamp(14px, 2.2vw, 22px);
    line-height: 1.9em;
    font-style: italic;
    text-align: left;
    height: 0.4%;
    width: 100%;
    color: red;
    left: 15%;
    margin: auto;


}

#search-results-container {
    flex: 0;
    height: 100%;
    display: block;
    position: absolute;
    width: 87%;
    max-width: 950px;
    min-width: 80px;
    left: 8%;
    right: 8%;
    top: 12.5%; 
    font-family: P052;
    font-size: clamp(18px, 2.5vw, 22px);
    font-style: normal;
    line-height: 1.7em;
    text-align: left;
    z-index: 500;

}

=================
Forms:

“custom_search_form”

<div id="searchbar-box" >
<form class="search-container" action="/search" method="get">
   <label for="search-field">&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Find something:&nbsp;</label>
  <input type="text" name="q" placeholder="&#x1F50E;&#xFE0F;  " class="search-input">
  <button type="submit">Go<class="search-button" >

  </button>
</form>
</div>

===================

“search_results”

<txp:search_result_title />
<txp:search_result_excerpt />
<txp:search_result_url />
<txp:search_result_date />
<txp:excerpt />
<txp:posted />

======================

Offline

#9 Yesterday 20:31:04

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,197
Website GitHub

Re: PHP Fun

Hi imazer,

For the search, there could be two reasons:

  • Look under Presentation › Sections and check that the section with your articles is set to be included in the site search.
  • You could try adding the attribute searchall="1" to your txp:article tag. The reason is that, when I look at your site, your search menu button points to the Back section. If I recall correctly, you then need to let Textpattern know to search in other sections and not just in the ‘Back’ section. I had problems with that myself a while back (see this thread).

(BTW: txp:search_results_count has been renamed to txp:items_count in version 4.9).

And the reason the thumbnails are not opening in a lightbox popup probably has to do with the fact that there is no lightbox script on the page. In your gallery section, your images are linked correctly and have a rel="lightbox" attribute, but because there’s no script to pick up on that, the browser simply shows the linked image on a blank page.


TXP Builders – finely-crafted code, design and txp

Offline

#10 Today 20:58:41

imazer
Member
Registered: 2024-06-19
Posts: 17

Re: PHP Fun

Hmph. I just wrote a missive, but the system had logged me out and I was not warned that I was typing into the either…

Anyway,

I appreciate the heads up on the rel=“lightbox” attribute. I had shifted over to a HTML/CSS gallery and no longer had lighbox installed. That was a straggling remnant of my older site that I needed to erase. Once I did, the gallery worked fine.

As for the search results, I already set the articles in Sections to “yes” for search. A good call, but not the problem. I changed txp:search_results_count over to txp:items_count, which made no apparent change. But when I added searchall=“1”, the section below my button would now offer either a comment about the absence of any results, or that there were contents, but then there was no listing of the results.

So, I erased my search results code, the replaced it with bog-standard code from the TXP documentations page. Here is what I am using now:

<txp:if_search>
    <txp:article searchall="1" pgonly="1" limit="10" />
    <txp:if_search_results>
        <p style="color: green;">These articles match your search request:</p>
        <txp:article limit="10" searchform="search_results" />
    <txp:else />
        <p style="color:red; text-align:center;" >Sorry, no page matching your search term <q><txp:search_term /></q>.</p>
    </txp:if_search_results>
</txp:if_search>

Still no listing of articles.

Offline

#11 Today 21:29:18

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,197
Website GitHub

Re: PHP Fun

imazer wrote #342551:

Still no listing of articles.

Your search page shows the message from within the <txp:if_search_results> but not the results. Add searchall="1" to the second txp:article tag as well. Then you should see the results.


TXP Builders – finely-crafted code, design and txp

Offline

#12 Today 22:36:01

imazer
Member
Registered: 2024-06-19
Posts: 17

Re: PHP Fun

You are quite right, jakob.

I was just going over the code just as — apparently — you were writing your message and worked that into the two places it needed to go, then the search result area populated!

Thanks!

I remember reading somewhere in the official info about duplicating exact expressions of code like this.

I put back my older code, then adjusted and it works. Now the results are a sort of run-on sentence that I want to break up into readable chunks. I’m too tired right now to remember, but I think the results were more elegantly laid out. But I will play with the code more.

Once more, wonderful help!

Offline

  1. Index
  2. » Troubleshooting
  3. » PHP Fun

Board footer

Powered by FluxBB