Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-08-15 15:26:24

lindabb
Member
Registered: 2023-02-17
Posts: 132

do more with textpattern

Hello,
Is it possible to have one of the pages have a list of items on one side and other side search items
What I mean is: searching, sorting, and paging on the same page, just like when you go to bestbuy.com and type laptop, then you will get a list of laptops.
and then on the left you have a search box and paging on the bottom and sorting on the top.
The CSS part is NOT the issue, but I’m having issues understanding how it works with the textpattern, where I put PHP/mySQL code in plugins or forms or on the page directly.

Any suggestion appreciated.

Thank you

Offline

#2 2024-08-15 15:49:57

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

Re: do more with textpattern

I would use a Page to hold the overall structure and then call Forms to populate the content:

e.g.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Independent scrolling panels</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <txp:css />
    </head>
    <body>
    <nav>
       <txp:output_form form="navbar" />
    </nav>
    <div class="container">
        <div class="filter">
            <txp:output_form form="filter_panel" />
        </div>
        <div class="main">
            <txp:output_form form="body_panel" />
        </div>
    </div>
    </body>
    <footer>
        <txp:output_form form="footer_block" />
    </footer>
</html>

You could also offload the stuff inside <head> to a form too if there’s a lot of it or if you have a few page templates that use the same (or very similar) header info.

Your forms for each block can then grab the content via article_custom – and use tags to fetch the custom fields and so forth to display each matching product.

Actually performing the filtering is more tricky but in Txp 4.9.0 you can use the URL for filtering by custom field fairly successfully. There’s an example that Oleg (etc) posted in the forum somewhere. If I (or anyone) finds it, we’ll link it here.


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

Online

#3 2024-08-15 15:59:11

lindabb
Member
Registered: 2023-02-17
Posts: 132

Re: do more with textpattern

Thank you so much, 
I will try the page then; as you suggested, I tried the form, and the plugin and article didn’t work as I expected; all have some kind of restriction (or I do not know how things work in textpattren). I’m struggling to understand the process.

Thank you

Offline

#4 2024-08-15 17:27:19

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

Re: do more with textpattern

You’re learning the principles with a quite complex example. You might want to start with a filter, then add sorting to your filter, then combine two filters and so on, before you try your full complexity all at once.

Just in case it’s not clear, the txp:article_custom and txp:article functions will only act on Textpattern articles, so your purchasable items need to be stored as articles in the system. Those functions won’t query other database tables of your own making.

There are two powerful plugins that you can use to craft own queries if that is what you need: smd_query (and on GitHub) and etc_query.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2024-08-15 23:24:00

lindabb
Member
Registered: 2023-02-17
Posts: 132

Re: do more with textpattern

Thank you both,
Done. After Bloke’s suggestion, I moved everything to a page, and everything works as I need it.
I had ,y code all over forms, plugins, articles, but all in one page works like a charm.

Thank you all for the support and suggestion I get here.

BTW: new member will join to use this platform soon, he loved the textpattern.

Offline

#6 2024-08-16 13:01:51

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

Re: do more with textpattern

lindabb wrote #337637:

I will try the page then; as you suggested, I tried the form, and the plugin and article didn’t work as I expected; all have some kind of restriction (or I do not know how things work in textpattren). I’m struggling to understand the process.

There’s a very quick orientation overview at Textpattern in two minutes which might help. The bits on presentation and reusable content may be of use.

Essentially, Pages and Forms do similar jobs insofar as they provide structural markup into which you put your <txp:...> replacement tags. But the split of what you put in each is up to you as site designer. Over time you may find that ‘fat’ Pages with lots of conditionals that call a bunch of ‘slim’ Forms (each with a specific task) works best for you on some sites.

Other times – especially if you have many Sections – you might find more streamlined Pages (like I outlined above) are more appropriate and you offload the conditional decision-making to slightly beefier Forms. That means you can get away with fewer Pages which (like Stylesheets) are assigned to Sections.

What you’re aiming for is modularising the content as much as possible to avoid duplication and repetition, letting Forms do the work of rendering repeated content like each entry in a list of articles, or content that has a similar look and feel across Sections. That way, it makes maintenance easier because you can change one Form and the changes are reflected across the site instantly.

I tend to stick to the ‘small page’ paradigm for most sites. I use a dedicated Page template for the frontpage, and then usually one Page for most sections that display articles, and sometimes a dedicated Page for sections that only house a single article (like a Contact Form or About page).

After that, I tend to pass things like form="article_main" listform="article_list" into <txp:article> tags. So every time the tag is encountered, if it’s on a landing page URL (e.g. /products/) it passes each article in the list through the article_list Form to put the markup on the page inside ul / li tags. But every time an individual article is encountered (e.g. /products/some-product), it passes the article through the article_main Form to format it in more detail, displaying custom fields, publication date and so on.

Then I can reuse the two Forms for other article tags across the site and if I change one of the Forms, the whole site is updated.

It takes a little experimentation to work out the best workflow for you, and each site is subtly different, but over time you’ll figure out the best way to arrange things to maximise the power of the tags and minimise the development effort in maintenance when the client says “can you please change the site so that…”

Plugins and plugin tags can appear anywhere on the public site if they’re exposed that way. There aren’t many restrictions, so if you can’t get the plugin to work as you expect, please post on the forum and show us what you’ve done and what you’re trying to achieve. We’ll endeavour to help.

BTW: new member will join to use this platform soon, he loved the textpattern.

Excellent, thank you. I hope he enjoys it and knows he can reach out here for support any time.


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

Online

#7 2024-08-16 16:45:33

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 309
Website GitHub GitLab Twitter

Re: do more with textpattern

Bloke wrote #337647:

Textpattern in two minutes

The brilliant intro!

Could you replace txstyle.org with textile-lang.com in a link?

Offline

#8 2024-08-16 19:44:31

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

Re: do more with textpattern

Vienuolis wrote #337650:

Could you replace txstyle.org with textile-lang.com in a link?

Good catch. Thank you. We’ll get that fixed.


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

Online

#9 2024-08-17 10:29:31

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,200
GitHub

Re: do more with textpattern

Vienuolis wrote #337650:

Could you replace txstyle.org with textile-lang.com in a link?

Done. Thanks for the report.

Offline

Board footer

Powered by FluxBB