Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Related articles: <txp:keywords />?
Oops change if variable
with if_variable
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#14 2012-08-13 18:56:46
- Alweb
- Member
- Registered: 2010-10-08
- Posts: 25
Re: Related articles: <txp:keywords />?
I’m sorry, but it still doesn’t work… :(
Offline
#15 2012-08-13 21:07:01
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Related articles: <txp:keywords />?
Most important, probably, is to remove one space in the first line of the code:
<txp:variable name="ra" value=''<txp:article_custom keywords='<txp:keywords />' limit="99" />'' />
In case this still doesn’t work, I’d try to swap single and doubled single apostrophes, resulting in
<txp:variable name="ra" value='<txp:article_custom keywords=''<txp:keywords />'' limit="99" />' />
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Related articles: <txp:keywords />?
uli wrote:
Most important, probably, is to remove one space in the first line of the code:
Well spotted! Done:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#17 2012-08-14 17:20:06
- Alweb
- Member
- Registered: 2010-10-08
- Posts: 25
Re: Related articles: <txp:keywords />?
I tried this also before, but it still doesn’t work. It also displays this error:
Tag error: <txp:image id=“1” /> -> Textpattern Notice: Unknown image. on line 176
There are nowhere images used.
Offline
#18 2012-08-14 18:26:07
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,305
Re: Related articles: <txp:keywords />?
There are nowhere images used.
The term “image” will stem from your own code, it’s not contained in this page’s snippets. If the error happens now and not before, it might be that you’ve tagging faults in your page/forms (tag(s) you didn’t open/close properly). If you don’t mind you could post your complete page and the form(s) it uses.
Re “doesn’t work”: What exactly doesn’t work? What code did you expect, what is output instead?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Related articles: <txp:keywords />?
<txp:image id="1" />
is the divider image which comes with the original install of txp.
Use smd_where_used to search, find and delete the tag although I think that it is normally found in Forms>default
.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#20 2012-08-16 19:43:22
- Alweb
- Member
- Registered: 2010-10-08
- Posts: 25
Re: Related articles: <txp:keywords />?
uli, the whole piece of the code I use for the related articles is posted on my previous post
colak, it’s indeed what you say about the default form.
- the label “Related articles” is not hidden when there are no related articles
- the “Tag error (image)”
- at the place where our variable is used, the form default is running. And I never “txp:output_form” the “default” form
{Edited to make the intended list formatting display in several lines – Uli}
Last edited by uli (2012-08-16 21:04:27)
Offline
Re: Related articles: <txp:keywords />?
the “Tag error (image)”
You can delete the <txp:image id="1"/>
tag from the default form
the label “Related articles” is not hidden
Try the code above again. I made some minor changes yesterday
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#22 2012-08-20 18:45:46
- Alweb
- Member
- Registered: 2010-10-08
- Posts: 25
Re: Related articles: <txp:keywords />?
Isn’t working, colak… The label still doesn’t hide. :-(
Offline
Re: Related articles: <txp:keywords />?
The problem is that <txp:article_custom keywords='<txp:keywords />' limit="99">
counts the current article too, so it is never empty. Try to replace it by <txp:article_custom keywords='<txp:keywords />' limit="2" offset="1">
in <txp:variable name="ra" ... />
definition.
Edit: or modify colak’s code like this:
<txp:variable name="ra">
<txp:article_custom keywords='<txp:keywords />' limit="99"><txp:if_article_id><txp:else />
<div class="secondary"> <txp:hide>I would change the li here to a div as I'm not cerain if divs can go in lis</txp:hide>
<article>
<div class="post-excerpt">
<h2 class="title title-xsmall"><a href="<txp:permlink />"><txp:title/></a></h2> <txp:hide>I am changing h1 to h2 here as you are only allowed one h1/page</txp:hide>
<txp:rss_auto_excerpt showlinkwithexcerpt="0" words="40" />
<span class="category"><a href="<txp:permlink />">(+) Read more...</a></span>
</div>
</article>
<div class="cleaner"> </div>
<div class="divider"> </div> <txp:hide>do you actually need 2 empty divs here?</txp:hide>
</div>
</txp:if_article_id>
</txp:article_custom>
</txp:variable><txp:hide>Set a variable</txp:hide>
<txp:if_variable name="ra" value=""> <txp:hide>if there are no related articles display nothing</txp:hide>
<txp:else />
<p class="widget-title">Related articles:</p> <txp:hide>if there are related articles display title and the divider div</txp:hide>
<div class="divider"> </div>
</txp:if_variable>
<div class="posts-list"><txp:hide>I would change the ul to a div as I'm not cerain if divs can go in lis (see below)</txp:hide>
<txp:variable name="ra" />
</div>
Last edited by etc (2012-08-20 20:44:30)
Offline