Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2024-09-06 10:21:05

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

Re: Ideas for emulating two file download categories?

Bloke wrote #337788:

Or maybe we don’t pass the thing directly to SQL but preprocess it? Internally replace underscores with \_ and just document it that if people want to use wildcards they need to use * which we internally preprocess to a regular underscore before passing to SQL.

Bit of a hack.

Done, under your responsibility :-)

Bloke wrote #337760:

Not ideal, but less work than splitting the filename on a delimiter and adding headers when the prefix changes.

These bits are actually easy:

<txp:if_different>
    <txp:file_download_name breakby="-" limit="1" />
</txp:if_different>

Offline

#14 2024-09-10 07:44:09

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: Ideas for emulating two file download categories?

Just so I understand correctly (I can’t easily test atm):

Two wild cards: % and * (as an alias for the SQL _). Do those two cover the same, e.g all assets in the example above?

Question: is the - delimiter required? Or is that just a convenience (it certainly does make for a readable category names in the example).


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

Offline

#15 2024-09-10 08:15:31

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

Re: Ideas for emulating two file download categories?

phiw13 wrote #337814:

Two wild cards: % and * (as an alias for the SQL _). Do those two cover the same, e.g all assets in the example above?

Yes, % is for any number of characters, and * matches one character, à la sql _. The underscore _ itself acts as a literal character, since it can be part of category names, unlike % and *.

Question: is the - delimiter required? Or is that just a convenience (it certainly does make for a readable category names in the example).

Not required at all, but is one of rare characters allowed in category names that is readable as delimiter when you need to split a name.

Offline

#16 2024-09-10 08:28:18

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: Ideas for emulating two file download categories?

etc wrote #337816:

Yes, % is for any number of characters, and * matches one character, à la sql _. The underscore _ itself acts as a literal character, since it can be part of category names, unlike % and *.

Thanks! I understand now. The is certainly a useful feature. And yes the - as part of the category name makes for readable and thus easy to use names.


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

Offline

#17 2024-09-10 08:31:07

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

Re: Ideas for emulating two file download categories?

We already use wildcards in cf queries, so there is nothing really disruptive here.

Offline

Board footer

Powered by FluxBB