Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-10-07 17:58:40

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

No articles appearing, no reason why not

Strange problem.

I have local site with a production sister.

The local was 4.6 beta, I updated to 4.6.1 and all is okay otherwise but the articles don’t appear anywhere on the site. This isn’t due to 4.6.1, however, because it was like that to begin with. I thought it was just skeleton content for dev purposes (it’s been a long time since I looked at it) and didn’t realize the full extent until afterward.

But once I realized and poked around, I couldn’t figure out what the problem was.

So then I thought I’d update the local with the production database, which is looking and running fine with 4.5.7. (Both local and prod are running MySQL 5.7.13). This was a dumb move on my part because I had had already fixed the pesky zeros in the DB tables on local and had to run through this entire process again, then edit the _to_4.6.0.php again. Ugh.

But that didn’t fix the article problem. I’ve run out of ideas what to check. The site uses only one plugin… rvm_maintenance, and that’s off.

.htaccess file contents: 
------------------------
# BEGIN Textpattern
#DirectoryIndex index.php index.html

#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /relative/web/path/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]

    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*) index.php

    RewriteCond %{HTTP:Authorization}  !^$
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0

<IfModule mod_mime.c>
    AddType image/svg+xml  svg svgz
    AddEncoding gzip       svgz
</IfModule>
# END Textpattern

p.

Offline

#2 2016-10-07 19:47:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: No articles appearing, no reason why not

Any use? Especially take note of etc’s response in which a mis-closed tag now trips up the parser. Previous parser instances were more lax in their parsing of tags.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2016-10-08 02:29:12

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: No articles appearing, no reason why not

Are the dates in the ‘Articles’ tab list grey or black?

Offline

#4 2016-10-08 09:37:50

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: No articles appearing, no reason why not

wet wrote #302028:

Are the dates in the ‘Articles’ tab list grey or black?

Black.

Bloke wrote #302025:

Any use? Especially take note of etc’s response in which a mis-closed tag now trips up the parser. Previous parser instances were more lax in their parsing of tags.

Not sure yet, but Pete’s post there did make me double-check “debug” mode again, and I came across a couple errors. I didn’t see them the first time because they only appeared on one section page:

<txp:article form="" id=""> Complained about the id. I changed that tag to an article_custom and the error went away on that on (though I’m not sure yet that meant proper use of an article_custom tag), but none of my site articles have reappeared yet.

The other error seems to be one of those “out of article context” situations when using conditional tags. I don’t know why after more than a decade, but conditional combos still confuse me.

Here’s the error:

Tag error: <txp:if_article_id id=“14”> -> Textpattern Notice: Article tags cannot be used outside an article context. while parsing form None on page Boutique

textpattern/lib/txplib_misc.php:5926 trigger_error()
textpattern/publish/taghandlers.php:1895 assert_article()
if_article_id()
textpattern/vendors/Textpattern/Tag/Registry.php:83 call_user_func()
textpattern/lib/txplib_publish.php:514 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:463 processTags()
textpattern/lib/txplib_misc.php:4476 parse()
textpattern/publish.php:562 parse_page()
index.php:105 textpattern()

And here’s the relevant page markup:

<txp:if_article_id id="14">

    <txp:hide> Display "Merci" article </txp:hide>
    <txp:article_custom form="shop-article" id="14" />

 <txp:else />

    <txp:if_article_id id="11">
      <txp:hide> Display "Pas prêt ?" article </txp:hide>
      <txp:article_custom form="shop-article" id="11" />
    </txp:if_article_id>

 <txp:else />

    <txp:hide> Display default "Boutique" article </txp:hide>
    <txp:article form="shop-article" status="sticky" />

</txp:if_article_id>

But even if this is the problem, that markup on an isolated section is enough to wipe out all articles on the entire site? I guess that’s good, because it means one is really forced to check the integrity of their tag architecture. But I suspect there will be a lot of troubleshooting posts coming. ;)

Offline

#5 2016-10-08 10:23:35

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: No articles appearing, no reason why not

Hi Destry,

your second <txp:else /> seems misplaced and might confuse the parser.

Offline

#6 2016-10-08 10:45:18

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: No articles appearing, no reason why not

That might be the reason. Where is that code appearing?

If this on an individual article page and if I have understood your code correctly, all articles are output with the same form but articles 11 and 14 are “live” articles while other boutique pages are sticky. If that’s the case, you can probably simplify it massively to:

<txp:if_individual_article>
    <txp:article form="shop-article" />
    <txp:article form="shop-article" status="sticky" />
</txp:if_individual_article>

If you’re using that in an article list somewhere on a page to respond to an article id, it would need to be looping through a list of article ids (i.e. from a wrapping txp:article or txp:article_custom) to test against. But then you’re nesting article_custom tags inside another article(_custom) tag to output one or the other live articles or else a sticky article. Unfortunately a wrapping txp:article_custom and txp:article tags can’t do live and sticky at the same time (years ago they could), so your sticky articles won’t show.

You could perhaps do the outer loop with rah_repeat and a list of article ids, and then use either smd_if to test if rah_repeat_value is 11 or 14 or alternatively place <txp:variable name="loop_article_id"><txp:rah_repeat_value /></txp:variable> in a variable and then do <txp:if_variable name="loop_article_id" value="11"> … etc. instead of the txp:if_article_id.

Then again, maybe I’ve misunderstood what you’re trying to do…


TXP Builders – finely-crafted code, design and txp

Offline

#7 2016-10-08 11:51:21

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: No articles appearing, no reason why not

I had to familiarize myself with the site again, but that code is the main content for the page in a “Boutique” section:

  • The sticky article contains two article lists for tools and wire products that connect with a simple PayPal cart.
  • Article 14 is the “thank you” article URL that PayPal returns a buyer to.
  • Article 11 is a “Maybe next time” article URL that PayPal returns a potential buyer to if they abandon ship.

Otherwise you’re just supposed to see the products grid (sticky article).

I tried changing to this, based on etc’s hint, but that just added another error:

<txp:if_article_id id="14">

    <txp:hide> Display "Merci" article </txp:hide>
    <txp:article_custom form="shop-article" id="14" />

 <txp:else />

    <txp:if_article_id id="11">
        <txp:hide> Display "Pas prêt ?" article </txp:hide>
        <txp:article_custom form="shop-article" id="11" />

    <txp:else />

        <txp:hide> Display default "Boutique" article </txp:hide>
        <txp:article form="shop-article" status="sticky" />
    </txp:if_article_id>

</txp:if_article_id>

Offline

#8 2016-10-08 12:00:56

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: No articles appearing, no reason why not

As I said, the whole article-context-in-relation-to-conditionals thing has always escaped me. I’ll keep rearranging the conditionals until I land on the right combo.

@Jakob: I’m sure you’re giving me the answer with your response there, but I’m not grasping what I should be doing.

All I can think of doing at this point is create a new section for the PayPal ‘return to site’ articles and use a simpler conditional on that page for one or the other articles, leaving the Boutique alone with a single article. But adding another section for that seems sloppy at best. Plus we may be going with MLP on this at some point to add English, and I want to keep sections/pages to a minimum when possible.

Last edited by Destry (2016-10-08 13:23:28)

Offline

#9 2016-10-08 14:27:00

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: No articles appearing, no reason why not

I think I’m getting it now. The articles 11 and 14 are called directly by their page name so they are individual articles. You have them as live-status articles.

What I can’t see is if the boutique is one article with the 7 items written into the body field, or does each item have an article of its own? This, or these, article(s) have sticky-status. I’m guessing it’s the former.

With your current setup, this should work:

<txp:if_individual_article>
    <txp:article form="shop-article" />
<txp:else />
    <txp:article form="shop-article" status="sticky" />
</txp:if_individual_article>

Then what happens is:

  • merci page = individual article, status=“live” (the default) -> shows the page from the url. You don’t need to test if it is 11 or 14 because that’s already specified by the url
  • maybe-later page = individual article, status=“live” as above
  • boutique page = landing page, shows the sticky article / up to 10 sticky articles.

— —

Assuming your boutique page is one article, you could simplify it further if you:

  • give all your articles live status
  • make boutique the most recent article chronologically

Then just use:

<txp:article form="shop-article" limit="1" />

That will always show one live article. On the landing page it will automatically start with the most recent article, the boutique page.

— —

If, for arguments sake, your shop were to expand to 25 items (i.e. gets hard to manage as a single article), you could make each boutique item an article of its own and then output the 25 articles on the landing page. In this case, I would reverse the logic you have now and make the “merci” page and “maybe-later” page the sticky articles – because it takes these special pages out of the normal list flow – and make each boutique product article a live article. Then you would do this:

<txp:article form="shop-article" status="sticky" />
<txp:article form="shop-article" limit="99" />

Then what happens is:

  • merci / maybe-later page = individual article, status=“sticky” -> first tag applies, second tag doesn’t
  • maybe-later page = individual article, status=“sticky” -> same story
  • boutique page = landing page -> these are live articles, so the first tag doesn’t apply, but the second does. It shows up to 99 articles of status=“live” (default), skipping the merci and maybe-later pages.

I’m pretty sure you know this – you wrote that great txp logic article all those years ago – so forgive me if I’m stating the obvious.


TXP Builders – finely-crafted code, design and txp

Offline

#10 2016-10-09 10:10:25

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: No articles appearing, no reason why not

I wasn’t as clear as I could be, sorry. All articles in question are assigned to the Boutique section, which uses a single page. The sticky is being used as the default landing article. All other articles are ‘live’ status. In the body of the sticky article are two article lists that output the respective tool and wire products. (The ability to use article tags in a body field like this has saved my bacon many times. I hope that has not changed.)

Regarding the “logic” article, you might be thinking about Jeff Soo’s thesis on context, which I should probably read again. I wrote the “building block” articles, which didn’t really cover context. Btw, does anyone know of a concise tutorial about tag context in relation to articles, notably in relation to conditionals and nesting tags? I think some kind of page like that needs to go in the docs under the tag section.

As for your other notes, Jakob, I’ll see if I can rebraid the yarn. :)

Offline

#11 2016-10-09 12:27:03

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: No articles appearing, no reason why not

Destry wrote #302051:

I wasn’t as clear as I could be, sorry. All articles in question are assigned to the Boutique section, which uses a single page. The sticky is being used as the default landing article. All other articles are ‘live’ status. In the body of the sticky article are two article lists that output the respective tool and wire products. (The ability to use article tags in a body field like this has saved my bacon many times. I hope that has not changed.)

Okay, so that’s a hybrid way. That is also the reason why I guess you were testing for article 11 or 14 in the individual article view, to prevent the individual products being callable individually. Perhaps this, then, would work for you:

<txp:if_individual_article>
  <txp:if_article_id id="11,14">
    <txp:article form="shop-article" />
  <txp:else />
    <txp:article_custom id="4" form="shop-article" status="sticky" />
  </txp:if_article_id>
<txp:else />
    <txp:article form="shop-article" status="sticky" />
</txp:if_individual_article>

where “4” is the article-id of the boutique article. That should act as my suggestion above, but additionally show the boutique if any of the other boutique product articles are called up individually.

It’s a bit of a workaround: you need to make sure your canonical url is then also the base “/boutique” url and/or better prevent search machines indexing the products. Alternatively – probably better – would be to put a redirect back to the landing “/boutique” page instead of the article_custom tag.

Regarding the “logic” article, you might be thinking about Jeff Soo’s thesis on context,

Ah, right you are!


TXP Builders – finely-crafted code, design and txp

Offline

#12 2016-10-09 16:38:19

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: No articles appearing, no reason why not

Again, I forgot to mention that each tool and wire product is an individual article in the boutique section, but I guess you figured that part out now. ;)

It never occurred to me to put both of the paypal response articles in the same tag (id="11,14"). That’s good. I’m still a little puzzled by the double instance of the sticky article in the conditional, but your structure does make the errors go away. Yeah!

However, articles still aren’t showing up on the front side in any section. So while we’ve cleaned up my tag architecture (and I’m grateful for learning that trick, thank you), that doesn’t seem to be what was causing the original problem.

Back to square one.

Offline

Board footer

Powered by FluxBB