Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-03 18:08:12

sereal
Member
From: Indonesia
Registered: 2010-02-18
Posts: 55

[help] article_custom using more than 1 form ?

Hi

I have a little problem here about displaying article_custom

this is my code:

<txp:article_custom section="info-one,info-two,info-three,info-four, banner-ads, some-links" form="article_short" wraptag="div" class="randArticles" sort="" limit="6" />

those sections are using a single form called article_short form

actually I need to use 3 forms because there are 2 sections not meant to be displayed as an usual article but I don’t know how to make it happen :(

the article_short form there should be used by these sections: info-one,info-two,info-three,info-four

and the sections called: banner-ads and some-links need to use different style of forms

how to make that happen ? is it possible ?

please advise

Last edited by sereal (2010-04-03 18:09:14)


$(mydocument).notyetready(function() {});
dowebsitesneedtolookexactlythesameineverybrowser ?

Offline

#2 2010-04-03 18:49:18

phuture303
Member
Registered: 2008-09-14
Posts: 127

Re: [help] article_custom using more than 1 form ?

<txp:if_section name="info-one,info-two,info-three,info-four">
<txp:article_custom section='<txp:section />' form="article_short" wraptag="div" class="randArticles" sort="" limit="6" />
</txp:if_section>

<txp:if_section name="banner_ads">
<txp:article_custom section="banner_ads" form="banner_ads" wraptag="div" class="randArticles" sort="" limit="6" />
</txp:if_section>

<txp:if_section name="some-links">
<txp:article_custom section="some-links" form="some-links" wraptag="div" class="randArticles" sort="" limit="6" />
</txp:if_section>

Last edited by phuture303 (2010-04-03 18:53:22)

Offline

#3 2010-04-03 19:18:05

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: [help] article_custom using more than 1 form ?

or another way:

<txp:article_custom section='<txp:section />' form='
  <txp:if_section name="info-one,info-two,info-three,info-four">
    article_short
  </txp:if_section>
  <txp:if_section name="banner_ads">
    banner_ads
  </txp:if_section>
  <txp:if_section name="some-links">
    some-links
  </txp:if_section> 
' wraptag="div" class="randArticles" sort="" limit="6" />

And you may want to look at rah_output_section_form


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#4 2010-04-03 19:44:02

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

Re: [help] article_custom using more than 1 form ?

Or a variation on the_ghost’s answer:

<txp:article_custom section='<txp:section />' wraptag="div" class="randArticles" sort="" limit="6">
   <txp:if_article_section name="info-one,info-two,info-three,info-four">
      <txp:output_form form="article_short" />
   </txp:if_article_section>
   <txp:if_article_section name="banner-ads">
      <txp:output_form form="banners_form" />
   </txp:if_article_section>
   <txp:if_article_section name="links">
      <txp:output_form form="links_form" />
   </txp:if_article_section>
</txp:article_custom>

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

#5 2010-04-03 20:14:20

phuture303
Member
Registered: 2008-09-14
Posts: 127

Re: [help] article_custom using more than 1 form ?

the_ghost, bloke – thanks! Good to see that there are shorter ways to do this.

Offline

#6 2010-04-04 07:01:53

sereal
Member
From: Indonesia
Registered: 2010-02-18
Posts: 55

Re: [help] article_custom using more than 1 form ?

wohoho…

Im very thankful for this help guys…

all works, but I think I like Bloke’s version, the ghost version is good too

hmmm…I think I have to re-arrange my form and pick which one suit my need

thank you guys…appreciate much for this


$(mydocument).notyetready(function() {});
dowebsitesneedtolookexactlythesameineverybrowser ?

Offline

#7 2010-04-04 21:06:46

sereal
Member
From: Indonesia
Registered: 2010-02-18
Posts: 55

Re: [help] article_custom using more than 1 form ?

to : Bloke

actually when I see your code, it looks really nice but It doesn’t work that way

the section=’<txp:section />’ output nothing

but it works when I declare all the section names

like this one below:

<txp:article_custom section="info-one,info-two,info-three,info-four,banner-ads,links" wraptag="div" class="randArticles" sort="" limit="6">
   <txp:if_article_section name="info-one,info-two,info-three,info-four">
      <txp:output_form form="article_short" />
   </txp:if_article_section>
   <txp:if_article_section name="banner-ads">
      <txp:output_form form="banners_form" />
   </txp:if_article_section>
   <txp:if_article_section name="links">
      <txp:output_form form="links_form" />
   </txp:if_article_section>
</txp:article_custom>

but I don’t know your perspective by declaring all the sections is a good way

Last edited by sereal (2010-04-04 21:07:09)


$(mydocument).notyetready(function() {});
dowebsitesneedtolookexactlythesameineverybrowser ?

Offline

#8 2010-04-04 21:40:01

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

Re: [help] article_custom using more than 1 form ?

sereal wrote:

when I see your code, it looks really nice but It doesn’t work that way

Oh, well I didn’t actually test the code :-) I just copied what the_ghost had done and rejigged it a little.

In theory, that part of the article_custom should only display posts from whichever section you are currently viewing. If that’s not what you want — maybe you want to see the output for all of the relevant sections all of the time — then you will have to do what you specified and list them all (or use <txp:section_list> to get an automatically-generated list).


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

#9 2010-04-05 01:28:56

sereal
Member
From: Indonesia
Registered: 2010-02-18
Posts: 55

Re: [help] article_custom using more than 1 form ?

<txp:section_list>

ah good point…

I’ll give a shot…

thanks Bloke :)


$(mydocument).notyetready(function() {});
dowebsitesneedtolookexactlythesameineverybrowser ?

Offline

Board footer

Powered by FluxBB