Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: aks_article : Extended article_custom tag
Changes aks_article v0.2.8:
- Shorthand for
list
attribute
Example:
<txp:aks_article category2="abc" limit="40" sort="title" wraptag="ul" break="li" time="all" list="permlink_nf" /> equivalent shorthand: <txp:aks_article category2="abc" limit="40" sort="title" list="all_ul_permlink_nf" />
Last edited by makss (2016-01-16 19:00:48)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_article : Extended article_custom tag
Hello,
actually I use the orphaned plugin chh_article_custom
. aks_article could be an interesting alternative. The problem is, that I use in chh_article_custom some functions aks_article seems to miss. Am I right?
For example:
<txp:chh_article_custom sortby="custom_7" sortdir="desc" wraptag="ul" break="li" limit="1" offset="0" section="artikel" listform="eins" time="-7 days" />
This means show me the first article of the last seven days ordered by custom field 7 in an unordered list, with no offset.
or a second example
<txp:chh_article_custom sortby="custom_7" sortdir="desc" wraptag="ul" break="li" limit="1" offset="1" section="artikel" listform="zwei_und_drei" time="-365 days,-31 days" />
Show me the second article in a list sorted by custom_7 older than one month and not older than one year.
Custom Field 7 is a number ….
Offline
Re: aks_article : Extended article_custom tag
whocarez wrote #277986:
The problem is, that I use in chh_article_custom some functions aks_article seems to miss. Am I right?
No, they are just called differently. Try
<txp:aks_article sort="custom_7 desc" wraptag="ul" break="li" limit="1" offset="1" section="artikel" form="zwei_und_drei"
where="DATEDIFF(Posted, NOW()) BETWEEN -365 AND -31" />
Last edited by etc (2014-01-10 10:41:32)
Offline
Re: aks_article : Extended article_custom tag
wow, cool … I`ll try it …
Offline
Re: aks_article : Extended article_custom tag
ok, it works perfect, thanks again …
another question whether I can use aks_article
to replace also chh_related_articles wich shows related articles by keywords …
this one doesn’t work: <txp:aks_article where='Keywords LIKE %<txp:keywords />%' limit="9" form="artikel-liste-text" />
At the moment I use <txp:chh_related_articles relation="category,keywords" limit="9" form="artikel-liste-text" />
any hint?
Offline
Re: aks_article : Extended article_custom tag
whocarez wrote #278004:
this one doesn’t work:
<txp:aks_article where='Keywords LIKE %<txp:keywords />%' limit="9" form="artikel-liste-text" />
You must quote the pattern in LIKE
clause somehow (to test):
<txp:aks_article where='Keywords LIKE "%<txp:keywords />%"' limit="9" form="artikel-liste-text" />
but this will restrict the list to the articles with keywords substring of <txp:keywords />
. Check if -related_articles keywords='<txp:keywords />'
attribute does the job for you.
Last edited by etc (2014-01-10 14:40:29)
Offline
Re: aks_article : Extended article_custom tag
ah, sometimes it is worth to look in the instruction :-)
anyway, the following lines make the job:
<txp:variable name="first_keyword" value='<txp:php>$text=explode(",",keywords());echo $text[0];</txp:php>' />
<txp:variable name="second_keyword" value='<txp:php>$text=explode(",",keywords());echo $text[1];</txp:php>' />
<txp:variable name="third_keyword" value='<txp:php>$text=explode(",",keywords());echo $text[2];</txp:php>' />
<txp:aks_article where='ID <> "<txp:article_id />" AND Keywords LIKE "%<txp:variable name="first_keyword" />%" OR "%<txp:variable name="second_keyword" />%" OR "%<txp:variable name="third_keyword" />%"' wraptag="" break="" limit="9" form="artikel-liste-text" section="artikel" />
Maybe there exists a cleverer solution …
Offline
Re: aks_article : Extended article_custom tag
whocarez wrote #278011:
anyway, the following lines make the job:
<txp:variable name="first_keyword" value='<txp:php>$text=explode(",",keywords());echo $text[0];</txp:php>' />...
Maybe there exists a cleverer solution …
I doubt it works as intended — all variables save first_keyword
will be ignored. If you don’t want to use plugins keywords
attribute (why?), you can try to mimic it as follows:
<txp:variable name="keywords"
value='<txp:php>$text=do_list(doSlash(keywords()));
echo implode("'', Keywords) OR FIND_IN_SET(''", $text);</txp:php>' />
<txp:aks_article wraptag="" break="" limit="9" form="artikel-liste-text" section="artikel"
where='ID <> "<txp:article_id />" AND ( FIND_IN_SET(''<txp:variable name="keywords" />'', Keywords) )' />
Edit: parentheses
Last edited by etc (2014-01-12 10:51:49)
Offline
Re: aks_article : Extended article_custom tag
ok, in principle <txp:aks_article where='ID <> "<txp:article_id />"' keywords='<txp:keywords />' wraptag="" break="" limit="9" form="artikel-liste-text" section="artikel" />
does also the job. But the upper variant with the first three keywords, allows me to weight the keywords. That means the first one is more important, than the second etc. So this way I can get older but maybe more relevant articles to the front.
With use of keywords I get the last articles with any of the used keywords in my list. chh_related_articles
worked like this, thus aks_article is a replacement for chh_related_articles
.
Offline
Re: aks_article : Extended article_custom tag
whocarez, etc: Thanks for the discussion and an interesting idea.
Small remark: where='ID <> "<txp:article_id />"'
equivalently hideself="1"
.
New version aks_article v0.2.9:- Added
search
feature (based on MySQL FULLTEXT search) – useful for get related articles or simle search.
.
Find related articles by search in Title, Body
fields. Sort by MySQL search scope.
<txp:aks_article hideself="1" search='<txp:keywords />' wraptag="ul" break="li" limit="20"> <txp:variable name="aks_article_scope"/> <txp:title /> </txp:aks_article>
Remark: <txp:variable name="aks_article_scope"/>
used only for debug.
.
Find related articles by search in Keywords
field.
Importantly: create FULLTEXT index for `textpattern` table. SQL command:
ALTER TABLE `textpattern` ADD FULLTEXT (`Keywords`);
Then you can use the code:
<txp:aks_article hideself="1" search='<txp:keywords />' searchfield="Keywords" wraptag="ul" break="li" limit="20"> <txp:variable name="aks_article_scope"/> <txp:title /> </txp:aks_article>
Last edited by makss (2016-01-16 19:01:31)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_article : Extended article_custom tag
Is there a way to edit aks_article so that it will also sort according to “position” as set with the stm_article_order plugin? stm_article_order works with the native txp:article_custom tag using sort=“position asc” I can’t figure out how it works with the native txp;article tags. Would love to be able to sort by position with aks_article too.
Offline
Re: aks_article : Extended article_custom tag
Try <txp:aks_article sort=“position asc” />
Sorting aks_article
works the same as in article_custom
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline