Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-06-30 09:29:11

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

Re: How can I create article lists from custom fields?

Kjeld wrote #330803:

I have already done the regular things like emptying cashes, refreshing, reinstalling plugins, turning off other plugins, checking Debugging mode.

Have you tried disabling all plugins, to be sure the problem is not there?

The .htaccess files also seem fine to me, but I might be missing something.

That might be another suspect. Multiple themes too.

Offline

#14 2021-06-30 10:29:14

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

etc wrote #330812:

Have you tried disabling all plugins, to be sure the problem is not there?

That might be another suspect. Multiple themes too.

“Multiple themes”? I am running my own theme…


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#15 2021-06-30 11:24:51

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

Bloke wrote #330807:

No ideas offhand if you’ve tried the usual stuff, sorry. Feel free to send me a login if possible to the test subdomain, and I’ll see if I can help figure it out.

Thanks, Bloke! Let me try a new installation first.


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#16 2021-07-01 03:12:54

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

Having lived in Japan pretty much all my life, I bow very deeply with my nose on the floor… 🙇

In spite of having used Textpattern for over 16 years, I embarrassingly did put match="location" in the wrong place. I have created several forms for different layouts and that ended up confusing (and blinding) me 😅

I put it in the right place and it works perfectly.

This confirms that I can indeed use match to replace chh_keywords on my old site. Up to the next challenge.

Thank you so much for you help!


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#17 2021-07-01 08:27:55

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

Re: How can I create article lists from custom fields?

Kjeld wrote #330848:

I embarrassingly did put match="location" in the wrong place. I have created several forms for different layouts and that ended up confusing (and blinding) me 😅

A warm feeling we all knew… Glad it works and good luck for the next challenge!

Offline

#18 2021-07-01 08:46:45

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

etc wrote #330852:

A warm feeling we all knew… Glad it works and good luck for the next challenge!

Thanks!


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#19 2021-07-06 09:21:02

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

Once again, thanks for all the help on this.

I have additional questions:

I use the following custom fields: location | period | artist

So, to create article lists with match you get url’s like this:

https://www.oldphotosjapan.com/photos/?location=Tokyo
https://www.oldphotosjapan.com/photos/?period=Meiji
https://www.oldphotosjapan.com/photos/?artist=Kuichi%20Uchida

My question:

  1. On my navigation bar I have dropdown menus for Location, Period and Artist.
  2. In each dropdown menu are the various locations, periods and artists
  3. If the current page shows an article list for Location I want to put a nav_active class in the wraptag of Location
  4. Same for Period and Artist
  5. Simultaneously, I want to put an active class in the wraptag of the item (eg. Tokyo, Meiji, Kuichi Uchida) in the dropdown menu.

I can get the information after the equal sign with tags like this:

<txp:page_url type="location" /> gives me Tokyo
<txp:page_url type="period" /> gives me Meiji
<txp:page_url type="artist" /> gives me Kuichi Uchida

But how do I get the name of the custom field after the ? and before the =?

And how do I make if statements to input the active class?


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#20 2021-07-06 10:00:59

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

Re: How can I create article lists from custom fields?

Kjeld wrote #330885:

how do I make if statements to input the active class?

Depends how you’re making your dropdowns. If you’re doing it by hand it should be easy to put something in the container/wrapper. txp:evaluate could help or, failing that, the usual <txp:variable> dance to assign the content of your page_url variable and then test it with if_variable in the loop that creates the dropdown.

There’s also a recent if_request tag, which might give you some further exploratory ideas.

I can get the information after the equal sign with tags like this <txp:page_url type="location" /> [snip] But how do I get the name of the custom field

Errr, do you need the name of the custom field, given that you’re essentially hard-coding the name of the custom field in the type attribute? Just type it directly in your template. If the custom field name ever changes, you’ll need to change your URLs and your dropdowns too anyway.


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

#21 2021-07-06 10:32:19

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

Re: How can I create article lists from custom fields?

How about:

<txp:if_request type="get" name="location">
   Location is active with value: <txp:page_url type="location" />
</txp:if_request>

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

#22 2021-07-06 10:35:22

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

Bloke wrote #330889:

How about:

<txp:if_request type="get" name="location"> Location is active with value: <txp:page_url type="location" /> </txp:if_request>

Thanks, Bloke. I will try that


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#23 2021-07-06 12:29:56

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

Bloke, thanks for putting the idea of doing it by hand into my mind. I had been thinking so hard about making automatic lists, I had become blinded to other options…

It simplified everything and solved a few problems, too.

Sometimes you need somebody to tell you, “hey look at that bird over there” just to reboot your thoughts 😅


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#24 2021-07-07 04:47:33

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: How can I create article lists from custom fields?

One more question, which probably also has a very simple solution, but which nonetheless completely eludes me:

I now have a dropdown menu for Places with the following selections:

Tokyo
Yokohama
Kyoto
Osaka
Kobe
Nagasaki

Each has a link in this format:

https://www.oldphotosjapan.com/photos/?location=Tokyo where location is the name of the custom field

I also want to add an entry with a link for Other, which shows all articles which have a place name other than Tokyo, Yokohama, Kyoto, Osaka, Kobe or Nagasaki in the custom field location.

How do I do this?


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

Board footer

Powered by FluxBB