Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-10-30 16:04:00

ywass
New Member
Registered: 2017-10-30
Posts: 5

Help Please...My article not displaying on my Homepage

Hello! I have read through the forum topics that are similar to my issue and I am not seeing an answer that seems directly related to my issue.

I am new to the Textpattern platform and I have been studying it to learn how to move around.

I have created a new Section and Page called Called to Artist on my website. www.artandculturecenter.org

I was able to get all of this to function but the issue I am struggling with is that I am unable to get the article to post onto my homepage.

I do have “yes” selected in the Section area for it to be on the front page, and here is the code that I have on the Call to Artist page:

<txp:output_form form="header"/>

<txp:if_article_list>
  <h2 class="place <txp:section />">Call To Artists</h2>

<txp:article_custom section="Call-to-Artists"  category="call-to-artists" time="any" sort="Posted" frontpage="1" sortdir="asc"/>


  <h2 class="place <txp:section />">Future Exhibitions</h2>

<txp:article_custom time="future" section="Visual-Arts" sort="Posted asc" limit="99" />

<txp:else />
  <txp:output_form form="sectionname"/>
  <txp:article time="any" sortby="Posted" sortdir="asc" form="individual" limit="1" />

    <txp:output_form form="other-articles" />

</txp:if_article_list>

<txp:output_form form="footer"/>

It the tag tutorial documentation it says to use frontpage=“1” in the article custom tag, but my article is still not loading into my homepage.

I also have playing around with the different setting in the article side and this is not working either.

I know I am missing something so any advice or input would be greatly appreciated.

Thanks!

Last edited by ruud (2017-10-30 17:17:41)

Offline

#2 2017-10-30 20:56:28

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Help Please...My article not displaying on my Homepage

I don’t know the context to understand everything.

But…

<txp:article_custom section="Call-to-Artists"  category="call-to-artists" time="any" sort="Posted" frontpage="1" sortdir="asc" />

… has no form. You need a form or use it as a container tag:

<txp:article_custom>
    …contained statements…
</txp:article_custom>

What’s in the form “individual”?

Furthermore: I don’t think there are sortby and sortdir, sort has two values, for example sort="Posted asc".

Offline

#3 2017-10-31 00:00:28

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

Re: Help Please...My article not displaying on my Homepage

Hi, and welcome to Textpattern. First of all, that’s a nice looking site!

With regards your problem, let’s look at a few things and just straighten out what you’re trying to do exactly. GugUser is right that there are a few attribute issues in your tags, but I don’t think that’s strictly the issue, because the code you posted seems to be working well on the call-to-artists page.

Let’s study the attributes anyway:

  • sortby and sortdir are no more. You should use sort="Posted asc" now.
  • the section attribute does work with mixed-case strings because it’s automatically lower-cased by the parser. But you’ll probably notice in the Section panel that the section name is all lower case, as it’s sanitized when you save the changes. So to avoid any potential head-scratching in future, it’s probably worth using the lower-case section name in that attribute.
  • using frontpage="1" in the tag in your call-to-artists landing page Page template won’t do anything. It’s only of use if the tag is used on the default Page. It filters out articles and only presents those articles that have ‘Yes’ in that column in the table on the Sections panel. In fact, from 4.7.0 we’ve renamed the column in the table to read On default page? because it’s then more obvious what it does.

From a cursory inspection of your code above and comparing it to the output of the call-to-artists section on your site, it seems the code is functioning perfectly well. The call-to-artists article is shown (so it must be in the given section AND the given category), then the contents of the future-dated articles in the visual-arts section are displayed. And if you visit the open-calls article, it uses the else branch of the above code. Without a form attribute it’ll use the default Form, btw.

What we cannot see is the code for your front page – your default Page template. That is where you will tell it to grab articles from other sections and display them on the home page. So please inspect that Page template and make sure it is being told to include articles from the call-to-artists section, or that the expected <txp:article> or <txp_article_custom> tag is being used. Try outputting some text around the tag you think is responsible for displaying the article you want and check that content between the bits of text does indeed match what you expect.

You can also put the site in Debugging mode from Admin->Preferences. If you then view the source code and check your article/article_custom tags in the trace at the bottom, you should see what queries the code is using and the results, which might enable you to track down why it’s not pulling your article out.

If all else fails, post relevant portions of your default Page template here and we’ll try and figure out what’s going on.

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

#4 2017-10-31 18:43:48

ywass
New Member
Registered: 2017-10-30
Posts: 5

Re: Help Please...My article not displaying on my Homepage

Thank you both for your time and guidance! I have gone through and cleaned up my call to artist page based upon the recommendations above in regards to the tags.

I did notice what you were talking about in regards to the form=”“ not being assigned to anything. I was I thought that this was why my article was not showing up on the home page.

So I took a look at the list of form items and I have several that relate to what I found on my homepage page…which was coded I am assuming as the default page. The default page is blank.

Here is the code for my homepage.

<!-- txp:page:homepage --> <txp:hide>

  DO NOT GO MESSING WITH THIS CODE!!

                            ,-.
       ___,---.__          /'|`\          __,---,___
    ,-'    \`    `-.____,-'  |  `-.____,-'    //    `-.
  ,'        |           ~'\     /`~           |        `.
 /      ___//              `. ,'          ,  , \___      \
|    ,-'   `-.__   _         |        ,    __,-'   `-.    |
|   /          /\_  `   .    |    ,      _/\          \   |
\  |           \ \`-.___ \   |   / ___,-'/ /           |  /
 \  \           | `._   `\\  |  //'   _,' |           /  /
  `-.\         /'  _ `---'' , . ``---' _  `\         /,-'
     ``       /     \    ,='/ \`=.    /     \       ''
             |__   /|\_,--.,-.--,--._/|\   __|
             /  `./  \\`\ |  |  | /,//' \,'  \
            /   /     ||--+--|--+-/-|     \   \
           |   |     /'\_\_\ | /_/_/`\     |   |
            \   \__, \_     `~'     _/ .__/   /
             `-._,-'   `-._______,-'   `-._,-'

  Notes

  safe_query tells Txp what the values in the custom field 'Featured'
  mean

  @ord3='Low', @ord4='' means low featured goes before non-featured
  @ord3='', @ord4='Low' means non-featured goes before low featured

  Featured="_%" just means any article that has any non-blank value
  in the Featured field

  <txp:php>
    safe_query("SET @ord1='High', @ord2='Medium', @ord3='Low', @ord4=''");
  </txp:php>


  <txp:variable name="hasarticles" value='<txp:article_custom time="future" limit="1" section="events" />' />
  <txp:if_variable name="hasarticles" value="">
    <p>your short message here</p>
  <txp:else />
    <txp:variable name="hasarticles" />
  </txp:if_variable>


</txp:hide>

<txp:output_form form="header"/>


<!-- Initialize database magic -->
<txp:php>
  safe_query("SET @ord1='100 High', @ord2='010 Medium', @ord3='', @ord4='001 Low'");
</txp:php>

<!-- 1 next future event -->
<txp:variable name="next-event" value='<txp:article_custom time="future" section="Events" limit="1" sort="Posted" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured-high future Events,fundraisers,Films,performing-arts, and about -->
<txp:variable name="featured-events-high" value='<txp:article_custom time="future" Featured="1%" section="Events,fundraisers,Films,performing-arts,about" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured future Events,fundraisers,Films,performing-arts, and about -->
<txp:variable name="featured-events" value='<txp:article_custom time="future" Featured="%1%" section="Events,fundraisers,Films,performing-arts,about" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured-high articles regardless of date: about,Distance-Learning,education-listing,Item,support -->
<txp:variable name="featured-non-events-high" value='<txp:article_custom time="any" Featured="1%" section="about,Distance-Learning,education-listing,Item,support,call-to-artist" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured articles regardless of date: about,Distance-Learning,education-listing,Item,support -->
<txp:variable name="featured-non-events" value='<txp:article_custom time="any" Featured="%1%" section="about,Distance-Learning,education-listing,Item,support" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Grab one blog post - "Featured" used only to sort -->

<txp:variable name="blog" value='<txp:article_custom time="past"  section="blog" limit="1" ><txp:article_id /></txp:article_custom>'/>


<!-- Grab one future exhibition unless we're between exhibitions -->
<txp:if_variable name="current-exhibitions" value="">
<txp:else />

  <txp:variable name="future-exhibition" value='<txp:article_custom time="future" section="visual-arts" sort="Posted asc" limit="1"><txp:article_id /></txp:article_custom>'/>

</txp:if_variable>


<!-- Grab TWO current or two future exhibitions -->

  <txp:if_variable name="current-exhibitions" value="">

<txp:variable name="current-exhibition" value='<txp:article_custom time="future" expired="0" section="visual-arts" sort="Posted asc" limit="2" offset="1" break=","><txp:article_id /></txp:article_custom>'/>

  <txp:else />

<txp:variable name="current-exhibition" value='<txp:article_custom time="past" expired="0" section="visual-arts" sort="Posted desc" limit="2" offset="1" break=","><txp:article_id /></txp:article_custom>'/>

  </txp:if_variable>



<!-- Combine all the gathered stuff and output -->


<div class="homepage">

<txp:article_custom section="homepage-note" expired="0" form="homepage-note" />

<!-- blah: featured high: ~<txp:variable name="featured-events-high"/>~ -->
<!-- blah: featured non-event high: ~<txp:variable name="featured-non-events-high"/>~ -->


<txp:if_variable name="featured-events-high" value=""><txp:else />
  <txp:article_custom id='<txp:variable name="featured-events-high"/>' time="any" form="homepage-featured-high" sort="Posted desc" />
</txp:if_variable>

<txp:if_variable name="featured-non-events-high" value=""><txp:else />
  <txp:article_custom id='<txp:variable name="featured-non-events-high"/>' time="any" form="homepage-featured-high" sort="Posted desc" />
</txp:if_variable>

  <!-- First current/future exhibition -->
    <txp:if_variable name="current-exhibitions" value="">

  <txp:article_custom time="future" section="visual-arts" sort="Posted asc" limit="1" form="homepage-featured" />

    <txp:else />
  <txp:article_custom time="past" expired="0" section="visual-arts" sort="Posted desc" limit="1" form="homepage-featured" />

    </txp:if_variable>

<!-- blah:regular -->

<txp:article_custom id='<txp:variable name="next-event"/>,<txp:variable name="featured-events"/>,<txp:variable name="featured-non-events"/>,<txp:variable name="blog"/>,<txp:variable name="current-exhibition"/>,<txp:variable name="future-exhibition"/>' time="any" form="homepage-featured" sort="FIELD(custom_11, @ord1, @ord2, @ord3, @ord4), Posted desc" limit="25" />

</div>

<txp:output_form form="email-signup-homepage"/>

<txp:output_form form="footer"/>

I tried adding into the blank form tag one of the form options mentioned in the above page and it still did not work.

Here is a the revised call to artist page code:

<!-- txp:page:call-to-artists -->

<txp:output_form form="header"/>

<txp:if_article_list>
  <h2 class="place <txp:section />">Call To Artists</h2>

<txp:article_custom section="call-to-artists"  category="call-to-artists" time="any" sort="Posted asc" />


  <h2 class="place <txp:section />">Future Exhibitions</h2>

<txp:article_custom time="future" section="Visual-Arts" sort="Posted asc" limit="99" />

<txp:else />
  <txp:output_form form="individual"/>
  <txp:article time="any" sortby="Posted" sortdir="asc" form="individual" limit="1" />

    <txp:output_form form="other-articles" />

</txp:if_article_list>

<txp:output_form form="footer"/>

In my forms section I have 5 forms that seem to be referenced in the homepage code above.
Here are the names:
homepage-featured
homepage-featured-high
individual
listing

One thing I am not putting together is in the form tags in the homepage code the names do not perfectly match the form name in the forms section. I see reference to “featured” not homepage-featured and “featured-high” not homepage-featured-high. The other part I’m not wrapping my head around is how the variable names are assigned.

Do I need to have this code on my page

<txp:else />
  <txp:output_form form="individual"/>
  <txp:article time="any" sortby="Posted" sortdir="asc" form="individual" limit="1" />
    <txp:output_form form="other-articles" />

and update all instance on the homepage to include call-to-artist?

<!-- Gather featured-high future Events,fundraisers,Films,performing-arts, and about -->
<txp:variable name="featured-events-high" value='<txp:article_custom time="future" Featured="1%" section="Events,fundraisers,Films,performing-arts,about" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured future Events,fundraisers,Films,performing-arts, and about -->
<txp:variable name="featured-events" value='<txp:article_custom time="future" Featured="%1%" section="Events,fundraisers,Films,performing-arts,about" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured-high articles regardless of date: about,Distance-Learning,education-listing,Item,support -->
<txp:variable name="featured-non-events-high" value='<txp:article_custom time="any" Featured="1%" section="about,Distance-Learning,education-listing,Item,support,call-to-artist" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured articles regardless of date: about,Distance-Learning,education-listing,Item,support -->
<txp:variable name="featured-non-events" value='<txp:article_custom time="any" Featured="%1%" section="about,Distance-Learning,education-listing,Item,support" break=","><txp:article_id /></txp:article_custom>'/>

Or is it as simple as converting these line of code on the homepage to point to my call-to artist section and page?

<!-- Grab one blog post - "Featured" used only to sort -->

<txp:variable name="blog" value='<txp:article_custom time="past"  section="blog" limit="1" ><txp:article_id /></txp:article_custom>'/>

I also looked at what version of Textpattern I am running and it is version 4.6.2.
Should I tackle upgrading it to the latest version 4.7 that you referenced above?

I am new here at this company and I am not the original designer…so I am trying to learn the platform as quickly as I can so that I can expand the site as is needed. I appreciate truely your time on my behalf.

Thanks
Yvette

Last edited by etc (2017-10-31 19:46:16)

Offline

#5 2017-10-31 20:10:57

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

Re: Help Please...My article not displaying on my Homepage

Hi Yvette, welcome to txp!

Your homepage code does not seem to include <txp:article /> tag, only <txp:article_custom /> filtered by section attribute. So yes, try to

update all instance on the homepage to include call-to-artist

Offline

#6 2017-10-31 20:15:42

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: Help Please...My article not displaying on my Homepage

Thanks etc for the code edit, so it’s easier to read and understand.

Offline

#7 2017-11-01 19:59:24

ywass
New Member
Registered: 2017-10-30
Posts: 5

Re: Help Please...My article not displaying on my Homepage

Ok..I tried what etc suggested and that did not work.

I know I am missing a step but I just can’t figure it out.

Here is my revised homepage code:

Notes

  safe_query tells Txp what the values in the custom field 'Featured'
  mean

  @ord3='Low', @ord4='' means low featured goes before non-featured
  @ord3='', @ord4='Low' means non-featured goes before low featured

  Featured="_%" just means any article that has any non-blank value
  in the Featured field

  <txp:php>
    safe_query("SET @ord1='High', @ord2='Medium', @ord3='Low', @ord4=''");
  </txp:php>


  <txp:variable name="hasarticles" value='<txp:article_custom time="future" limit="1" section="events" />' />
  <txp:if_variable name="hasarticles" value="">
    <p>your short message here</p>
  <txp:else />
    <txp:variable name="hasarticles" />
  </txp:if_variable>


</txp:hide>

<txp:output_form form="header"/>


<!-- Initialize database magic -->
<txp:php>
  safe_query("SET @ord1='100 High', @ord2='010 Medium', @ord3='', @ord4='001 Low'");
</txp:php>

<!-- 1 next future event -->
<txp:variable name="next-event" value='<txp:article_custom time="future" section="Events" limit="1" sort="Posted" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured-high future Events,fundraisers,Films,performing-arts, and about -->
<txp:variable name="featured-events-high" value='<txp:article_custom time="future" Featured="1%" section="Events,fundraisers,Films,performing-arts,about,call-to-artist" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured future Events,fundraisers,Films,performing-arts, and about -->
<txp:variable name="featured-events" value='<txp:article_custom time="future" Featured="%1%" section="Events,fundraisers,Films,performing-arts,about,call-to-artist" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured-high articles regardless of date: about,Distance-Learning,education-listing,Item,support -->
<txp:variable name="featured-non-events-high" value='<txp:article_custom time="any" Featured="1%" section="about,Distance-Learning,education-listing,Item,support,call-to-artist" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Gather featured articles regardless of date: about,Distance-Learning,education-listing,Item,support -->
<txp:variable name="featured-non-events" value='<txp:article_custom time="any" Featured="%1%" section="about,Distance-Learning,education-listing,Item,support,call-to-artist" break=","><txp:article_id /></txp:article_custom>'/>

<!-- Grab one blog post - "Featured" used only to sort -->

<txp:variable name="blog" value='<txp:article_custom time="past"  section="blog" limit="1" ><txp:article_id /></txp:article_custom>'/>

<!-- Grab one call to artist post - "Featured" used only to sort -->

<txp:variable name="call-to-artist" value='<txp:article_custom time="past"  section="call-to-artist" limit="1" ><txp:article_id /></txp:article_custom>'/>


<!-- Grab one future exhibition unless we're between exhibitions -->
<txp:if_variable name="current-exhibitions" value="">
<txp:else />

  <txp:variable name="future-exhibition" value='<txp:article_custom time="future" section="visual-arts" sort="Posted asc" limit="1"><txp:article_id /></txp:article_custom>'/>

</txp:if_variable>


<!-- Grab TWO current or two future exhibitions -->

  <txp:if_variable name="current-exhibitions" value="">

<txp:variable name="current-exhibition" value='<txp:article_custom time="future" expired="0" section="visual-arts" sort="Posted asc" limit="2" offset="1" break=","><txp:article_id /></txp:article_custom>'/>

  <txp:else />

<txp:variable name="current-exhibition" value='<txp:article_custom time="past" expired="0" section="visual-arts" sort="Posted desc" limit="2" offset="1" break=","><txp:article_id /></txp:article_custom>'/>

  </txp:if_variable>



<!-- Combine all the gathered stuff and output -->


<div class="homepage">

<txp:article_custom section="homepage-note" expired="0" form="homepage-note" />

<!-- blah: featured high: ~<txp:variable name="featured-events-high"/>~ -->
<!-- blah: featured non-event high: ~<txp:variable name="featured-non-events-high"/>~ -->


<txp:if_variable name="featured-events-high" value=""><txp:else />
  <txp:article_custom id='<txp:variable name="featured-events-high"/>' time="any" form="homepage-featured-high" sort="Posted desc" />
</txp:if_variable>

<txp:if_variable name="featured-non-events-high" value=""><txp:else />
  <txp:article_custom id='<txp:variable name="featured-non-events-high"/>' time="any" form="homepage-featured-high" sort="Posted desc" />
</txp:if_variable>

  <!-- First current/future exhibition -->
    <txp:if_variable name="current-exhibitions" value="">

  <txp:article_custom time="future" section="visual-arts" sort="Posted asc" limit="1" form="homepage-featured" />

    <txp:else />
  <txp:article_custom time="past" expired="0" section="visual-arts" sort="Posted desc" limit="1" form="homepage-featured" />

    </txp:if_variable>

<!-- blah:regular -->

<txp:article_custom id='<txp:variable name="next-event"/>,<txp:variable name="featured-events"/>,<txp:variable name="featured-non-events"/>,<txp:variable name="blog"/>,<txp:variable name="current-exhibition"/>,<txp:variable name="future-exhibition"/>' time="any" form="homepage-featured" sort="FIELD(custom_11, @ord1, @ord2, @ord3, @ord4), Posted desc" limit="25" />

</div>

<txp:output_form form="email-signup-homepage"/>

<txp:output_form form="footer"/>

Here is my call-to-artist page code:

<!-- txp:page:call-to-artists -->

<txp:output_form form="header"/>

<txp:if_article_list>
  <h2 class="place <txp:section />">Call To Artists</h2>

<txp:article_custom section="call-to-artists"  category="call-to-artists" time="any" sort="Posted asc" />


  <h2 class="place <txp:section />">Future Exhibitions</h2>

<txp:article_custom time="future" section="Visual-Arts" sort="Posted asc" limit="99" />

<txp:else />
<txp:output_form form="call-to-artist"/>
  <txp:article time="any" sortby="Posted" sortdir="asc" form="individual" limit="1" />


    <txp:output_form form="other-articles" />

</txp:if_article_list>

<txp:output_form form="footer"/>

I created a call-to-artist form thinking that that might be my issue and no luck with that either.
Here is my code for that.

<txp:output_form form="header"/>

<!-- txp:page:individual -->

<txp:if_article_list>

  <!-- Individual page, article list -->

  <txp:if_section name="Item"><txp:else />
    <h2 class="place">
      <txp:section title="1" link="0" /><txp:if_category>: <txp:category title="1" /></txp:if_category>
    </h2>
  </txp:if_section>

  <txp:article time="any" status="sticky" />

  <txp:if_section name="education-listing">
    <txp:article time="any" sortby="Posted" sortdir="desc" />
  <txp:else />
    <txp:article time="future" sortby="Posted" sortdir="asc" />
  </txp:if_section>

<txp:else />


  <!-- Individual page, single article -->

  <txp:article time="any" sortby="Posted" sortdir="asc" form="individual" limit="1" />

  <txp:output_form form="other-articles"/>


</txp:if_article_list>

<txp:output_form form="footer" />

Thank you all for taking the time to look through this and helping me nail this down.

Yvette

Added some sprinkles of Textile markup to structure the post.
– Uli –

Last edited by uli (2017-11-01 20:20:11)

Offline

#8 2017-11-01 20:25:27

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,305

Re: Help Please...My article not displaying on my Homepage

Yvette, please take the time to use Textile markup in order to make your posts readable by separating code from your annotations, especially bc.. (two dots for creating blocks of code with blank lines in it) and p. for re-starting normal text mode. Thank you :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2017-11-01 21:01:22

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

Re: Help Please...My article not displaying on my Homepage

It looks like Featured custom field of your articles must contain 1, please check.

Offline

#10 2017-11-02 13:21:15

ywass
New Member
Registered: 2017-10-30
Posts: 5

Re: Help Please...My article not displaying on my Homepage

Thank etc! When you say Featured do you mean selecting that option in the article section itself and placing “1” as a priority; or do I add this into my code on my page coding?

Thanks
Yvette

Offline

#11 2017-11-02 13:26:45

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

Re: Help Please...My article not displaying on my Homepage

When you edit an article (Write tab), try to put 100 or 010 into Featured custom field. It’s not a Textpattern requirement, just the site is designed this way.

Offline

#12 2017-11-02 13:36:34

ywass
New Member
Registered: 2017-10-30
Posts: 5

Re: Help Please...My article not displaying on my Homepage

Hi…etc…I have tried that several times and I just gave it another shot. It is not showing up on the home page. So then it is something missing in the coding correct?

Offline

Board footer

Powered by FluxBB