Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Double article entry after making it hidden :(
Hi
I was with a client today and was showing him how to hide an article, then make it live again. When I did it and we check the site to see, it was listed twice – both using the same url!
I tried a few more things, and couldnt change it back. When I got back I checked in the database and there was only 1 entry in the textpattern table.
I am using keywords and an article custom form to display the article.
<txp:article_custom keywords="aussie" form="course" section="courses" sortdir="asc" />
I’m also txp 4.08 with only txp native tags on the page… there is google anylytics code on there though
Any ideas?
Offline
#2 2009-04-08 10:23:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Double article entry after making it hidden :(
Can you post a tag trace of the page that shows the article twice?
Offline
Re: Double article entry after making it hidden :(
The article is id34
<!-- Runtime: 0.0395 -->
<!-- Query time: 0.005111 -->
<!-- Queries: 19 -->
<!-- Memory: 3176Kb, <txp:title /> -->
<!-- txp tag trace:
[SQL (0.000200033187866): select name, data from txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.000406980514526): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.000562906265259): select name,code,version from txp_plugin where status = 1 AND name='gbp_admin_library']
[SQL (0.000190019607544): select name from txp_section where `name` like 'courses' limit 1]
[SQL (7.70092010498E-5): select page, css from txp_section where name = 'courses' limit 1]
[SQL (0.00031304359436): select host from txp_log where ip='59.167.244.136' limit 1]
[SQL (0.000107049942017): select user_html from txp_page where name='Courses']
[Page: Courses]
<txp:ob1_title order="%article,%category,%section,%sitename" separator=" - " />
[SQL (4.57763671875E-5): select title from txp_section where name = 'courses' limit 1]
[SQL (7.31945037842E-5): select title from txp_category where name = '' limit 1]
<txp:css />
<txp:output_form form="navigation" />
[SQL (8.32080841064E-5): select Form from txp_form where name='navigation']
[Form: navigation]
<txp:search_input wraptag="" label="Search Site" />
[SQL (6.29425048828E-5): select form from txp_form where `name` = 'search_input' limit 1]
<txp:output_form form="language" />
[SQL (8.20159912109E-5): select Form from txp_form where name='language']
[Form: language]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:article_custom form="course" keywords="international" section="courses" sortdir="asc" />
[SQL (0.000805139541626): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('courses') and (FIND_IN_SET('international',Keywords)) order by Posted asc limit 0, 10]
[article 15]
[SQL (4.60147857666E-5): select Form from txp_form where name='course']
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 16]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 17]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 18]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 20]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 28]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 30]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
<txp:article_custom keywords="aussie" form="course" section="courses" sortdir="asc" />
[SQL (0.000509977340698): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('courses') and (FIND_IN_SET('aussie',Keywords)) order by Posted asc limit 0, 10]
[article 21]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 34]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
</txp:if_article_list>
<txp:article form="course" section="courses" />
[SQL (0.000317096710205): select count(*) from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('courses')]
[SQL (0.000612020492554): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and Section IN ('courses') order by Posted desc limit 0, 10]
[article 34]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 30]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 28]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 21]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 19]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 20]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 18]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 17]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 16]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[article 15]
[Form: course]
<txp:if_article_list>
[<txp:if_article_list>: true]
<txp:permlink />
<txp:title />
</txp:if_article_list>
[ ~~~ secondpass ~~~ ]
-->
Offline
Re: Double article entry after making it hidden :(
Article 34 shows up in the tag trace twice, once with <txp:article_custom keywords="aussie" form="course" section="courses" sortdir="asc" />
and again with <txp:article form="course" section="courses" />
.
The first instance is inside your main <txp:if_article_list>
conditional, the second is not in a conditional situation so will show in article list and individual article (txp:article is also context-sensitive). It the section is supposed to show only in individual article view, you need either to use <txp:if_article_list> ... <txp:else /> ... </txp:if_article_list>
or <txp:if_article_list> ... </txp:if_article_list><txp:if_individual_article> ... </txp:if_if_individual_article>
.
If I’m reading the tag trace correctly, it looks like you form also checks for if_article_list.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Double article entry after making it hidden :(
You are calling twice on purpose ;) See your keyword listing <txp:article_custom />
s and <txp:article />
. And it is leading to same url, because it is the same article, listed twice by human hand.
You can remove it by little tweaking your keyword and article listing. For example building keyword listings with if different, or by custom field/keyword defining which articles show in the <txp:article />
listing.
And well, your all articles will show twice (because you are just calling them twice), if they are new enough (that they go to the txp:article
listing) and have one of the keywords that are listed in the <txp:article_custom />
listings.
Offline
Re: Double article entry after making it hidden :(
Cool – that was it… me calling it twice… thanks :)
The strange thing is, all articles were displaying fine until I changed the status to hidden, then back to live – we were working on this page all day and this wasn’t displaying twice until we changed that – wierd.
I’d just upgraded to 4.08 a few weeks ago, and have been noticing a few (on my part) badly formed txp tags showing up from my old installs… – so I wonder if this was one of them.
Whatever the reason – tag trace is great, now I just need to study them in more details
Thanks for helping :)
Offline
Re: Double article entry after making it hidden :(
tye wrote:
The strange thing is, all articles were displaying fine until I changed the status to hidden, then back to live – we were working on this page all day and this wasn’t displaying twice until we changed that – wierd.
Probably because publishing date got updated, as a side efect to the status change, and thus the article popped to the top of the <txp:article/>
listing, that is by default sorted by Posted desc
, and bottom of <txp:article_custom />
that is sorted by you with Posted asc
.
Oh yeah, that reminded me that your using sortdir
-attribute is kinda deprecated, so you should change it to current sort
aka sort="Posted asc"
.
Last edited by Gocom (2009-04-08 14:07:39)
Offline
Re: Double article entry after making it hidden :(
Gocom wrote:
tye wrote:
Oh yeah, that reminded me that your using
sortdir
-attribute is kinda deprecated, so you should change it to currentsort
akasort="Posted asc"
.
I spotted that and already changed it – thanks though :)
Offline