Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-02-21 03:50:19
- sultanofsand
- New Member
- Registered: 2008-02-21
- Posts: 3
Article Duplicates in Individual Article Page
Ok, Im a completely beginner in this and many areas that are related to CMS and how they work etc…
I have my page set up nicely…it has dynamic content on the main body and then to the side i have some content that i want to go across all pages. I set that up no problem. Except that some of those things I wanted to be able to edit without having to go into both the archive and default page templates each time so i set up a a new section named updates and basically set it to no on all the options where you set section options to prevent it from posting like a new article everytime i edited it through the “write” option.
I created a custom form for the article and named it “update” which just contained the tag <txp:body /> because thats all that i really wanted to carry over. then i went into my default page and inserted the following where i wanted that do be displayed on the page …
<h4> [] What's New?</h4>
<txp:article_custom id="10" form="update" />
the “id” being the id number of the article, published in the new update section, so that it would call that specific one to where i wanted it.
Now the problem is that when I view an individual article page it duplicates the main article and places it both where it should be as well as where that piece of code above is (just the bodyof it in the latter place due to the form i created). How can I get it to display the article that the code is referring to on individual article pages rather than that specific pages article?
I’ve searched for days on this through the forums as well as other sites and got nowhere.
Like i said, im a novice at this.
Plz help.
Thanks
Offline
Re: Article Duplicates in Individual Article Page
Try adding section="updates"
to the article_custom tag. It isn’t context-sensitive like the article tag so that might be your problem. Also, if article 10 is the only article in the new section you won’t need the “id” attribute.
Last edited by thebombsite (2008-02-21 14:30:55)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2008-02-21 15:38:18
- sultanofsand
- New Member
- Registered: 2008-02-21
- Posts: 3
Re: Article Duplicates in Individual Article Page
I tried that but it didnt work. I also changed the tag from article_custom to an article tag and got the same result after adding in you suggestion.
also i have 2 other articles in the “update” section so thats why i specified the ID.
so now my code looks like this…
<h4> : : What's New? : : </h4>
<txp:article_custom id="10" form="update" section="update" />
but its still doing the same thing.
So messing around on ths site i found out what probably is causing the problem. I had changed the default form in order to show excerpts on the front page as well as section pages…
that code looks like this…
<txp:if_individual_article>
<h2 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h2>
<txp:else />
<h3 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h3>
</txp:if_individual_article>
<p class="published"><txp:posted /></p>
<txp:if_article_list>
<txp:if_excerpt>
<txp:excerpt />
<address class="vcard author">— <span class="fn"><txp:author /></span></address>
<p class="read"><txp:permlink>Read more...</txp:permlink></p>
<p class="tags"><txp:category1 title="1" link="1" /> <txp:category2 title="1" link="1" /></p>
<txp:else />
<txp:body />
<address class="vcard author">— <span class="fn"><txp:author /></span></address>
<p class="tags"><txp:category1 title="1" link="1" /> <txp:category2 title="1" link="1" /></p>
</txp:if_excerpt>
<txp:else />
<div class="entry-content">
<txp:body />
<address class="vcard author">— <span class="fn"><txp:author /></span></address>
<p class="tags"><txp:category1 title="1" link="1" /> <txp:category2 title="1" link="1" /></p>
</div>
</txp:if_article_list>
the results are:
1) excerpts if any on the front page instead of the body (good)
2) Nothing on the sections pages
3) The articles do not duplicate on individual article pages that do not have excepts for those articles (good). BUT do duplicate on the individual article pages that do have excepts for those specific articles. (basically that tips me off to the problem).
So… i got rid of the code i added for getting excerpts, leaving the default form as it originally comes. and that fixed my original problem.
Hehe, now with all that said and done… how do I get excerpts if there are any to be displayed on the front page as well as the section pages instead of the body?
interestingly enough, i got the excerpt code (and thought i could adapt it) from your thebombsite. thanks a bunch…i just dont know how to use it the right way.
Last edited by sultanofsand (2008-02-21 17:05:57)
Offline
Re: Article Duplicates in Individual Article Page
Oh, in that case it’s definitely my fault. :)
I can’t see anything obviously wrong with the above code so let me just check some facts. The code above is a “form” template?
What tag do you use in your page template to call it?
In your first post you say “i set up a a new section named updates” so is it updates or update?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Article Duplicates in Individual Article Page
sultanofsand wrote:
<txp:if_article_list>
<txp:if_excerpt>
…
<txp:else />
…
</txp:if_excerpt>
<txp:else />
…
</txp:if_article_list>
I’m not sure how TXP resolves the nested conditional you have created. That is, when it reaches the first thanks Ruud, good to know!<txp:else />
tag, it may apply that to the the first open conditional (if_article_list
) instead of the one you want. This could explain the behavior you have described.
Last edited by jsoo (2008-02-21 23:07:39)
Code is topiary
Offline
Re: Article Duplicates in Individual Article Page
^^ the nesting isn’t a problem here. The if/else parser uses the else tag that matches with the current level of nesting. However, it’s slightly faster to do this:
<txp:if_article_list>
<txp:if_excerpt>
…
<txp:else />
…
</txp:if_excerpt>
</txp:if_article_list>
<txp:if_individual_article>
…
</txp:if_individual_article>
Offline
#7 2008-02-22 02:47:01
- sultanofsand
- New Member
- Registered: 2008-02-21
- Posts: 3
Re: Article Duplicates in Individual Article Page
Thanks guys, problem solved.
Stuart – it was “update” I had made a mistake in typing it. my apologies. And the form was the “default” form that comes with textpattern which I had edited. In any case, thanks for your help and the excerpt code. :)
And thank you Ruud for showing me how to use it. I used what you said, except that I nested the “if_individual_article” conditional within the “if_article_list” condition. This got me exactly what I wanted.
<txp:if_article_list>
…
<txp:if_excerpt>
…
<txp:else />
…
</txp:if_excerpt>
<txp:else />
<txp:if_individual_article>
…
</txp:if_individual_article>
</txp:if_article_list>
I nested it in there because it was repeating some things or leaving them out in certain pages and putting them in an unpleasant order on others. But now everything is working great on all pages after nesting it.
Last edited by sultanofsand (2008-02-22 02:58:52)
Offline