Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-02-22 13:42:59

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

News Plugin

Hello,
Is there news plugin ?
What I mean , different table called news with different title and subject , can be viewed anywhere in any page other than article.
article maybe change daily, but new can.
if not, how I accomplish this with articles table ?
Thank you

Offline

#2 2023-02-22 14:28:53

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

Re: News Plugin

There isn’t a plugin as such, but if I understand correctly you may not need one.

Take a look at the concept of pageless sections. What you could do is create a ‘news’ section and set it to have no page or style. Then, write your news articles as normal and assign them to the ‘news’ section.

Finally, in your existing page template(s) somewhere, add a call to <txp:article_custom section="news" /> to grab the latest articles from there and put them on your page somewhere, either as a list or excerpts, or whatever.

Do note, however, that you won’t be able to specify permlinks to the individual news articles because they exist in a section that has no template.

If that seems too restrictive, you don’t have to make them pageless. You can just create your news section like a regular section and populate it with article content, then use txp:article_custom to drag content to any other area of your site you wish to display it. That way, you can make links to the individual news articles too.

Hope that helps.


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 2023-02-22 14:58:30

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

Re: News Plugin

Thank you Bloke,
I will try that, I tried this and not sure if works or not, using custom fields , renamed it, i called type value news, then

<txp:article_custom id=“6” >
<txp:if_custom_field name=“type” value=“news”> <h1><txp:title/></h1> <p><txp:body/></p>
</txp:if_custom_field>
</txp:article_custom>

I don’t feel this is the right way to do it,
I will try your suggestion and see how works!

BTW: I’m trying to migrate my site from microcms apphp framework (abandoned, doesn’t support php 8 and up) to textpattern.

Thanks again for your kind help.

Offline

#4 2023-02-22 15:14:06

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: News Plugin

lindabb wrote #334705:

Thank you Bloke,
I will try that, I tried this and not sure if works or not, using custom fields , renamed it, i called type value news, then

<txp:article_custom id=“6” >
<txp:if_custom_field name=“type” value=“news”> <h1><txp:title/></h1> <p><txp:body/></p>
</txp:if_custom_field>
</txp:article_custom>

I don’t feel this is the right way to do it,
I will try your suggestion and see how works!

BTW: I’m trying to migrate my site from microcms apphp framework (abandoned, doesn’t support php 8 and up) to textpattern.

Thanks again for your kind help.

Is there a reason you are you calling just one article? (<txp:article_custom id="6">).


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2023-02-22 15:18:35

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

Re: News Plugin

Thanks Bloke,
I just tried your suggestion and look works better than my work. now all I need to get the body trimmed!

Thanks again for your help

Offline

#6 2023-02-22 15:24:53

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

Re: News Plugin

Hi Yiannis, thank you for asking that,
No I need more like limit 10 , but that was just a test to see if works.

So far, I’m testing and documenting my work with textpattern, so far so good. I like the active and helpful forum here unlike many PHP MVC dead or will die soon!

Thanks again

Offline

Board footer

Powered by FluxBB