{"action":"created","issue":{"url":"https://api.github.com/repos/textpattern/textpattern/issues/35","labels_url":"https://api.github.com/repos/textpattern/textpattern/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/textpattern/textpattern/issues/35/comments","events_url":"https://api.github.com/repos/textpattern/textpattern/issues/35/events","html_url":"https://github.com/textpattern/textpattern/issues/35","id":44881101,"number":35,"title":"txp:if_article_id on article list context","user":{"login":"ghost","id":10137,"avatar_url":"https://avatars.githubusercontent.com/u/10137?v=3","gravatar_id":"","url":"https://api.github.com/users/ghost","html_url":"https://github.com/ghost","followers_url":"https://api.github.com/users/ghost/followers","following_url":"https://api.github.com/users/ghost/following{/other_user}","gists_url":"https://api.github.com/users/ghost/gists{/gist_id}","starred_url":"https://api.github.com/users/ghost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghost/subscriptions","organizations_url":"https://api.github.com/users/ghost/orgs","repos_url":"https://api.github.com/users/ghost/repos","events_url":"https://api.github.com/users/ghost/events{/privacy}","received_events_url":"https://api.github.com/users/ghost/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-10-04T12:26:17Z","updated_at":"2015-08-15T11:37:52Z","closed_at":null,"body":"_From [mani...@gmail.com](https://code.google.com/u/103275418227060920055/) on August 26, 2009 00:53:46_\n\nWhen on individual article context, the following snippet work as expected:\r\nif I'm viewing article X, then article X title is not linked on the\r\ngenerated output. Great!\r\n\r\n<txp:article_custom file_id=\"_&#37;\" section='<txp:section />' >\r\n  <txp:if_article_id>\r\n    <h3><txp:title /></h3>\r\n  <txp:else />\r\n    <h3><a href=\"<txp:permlink />\" rel=\"bookmark\" title=\"Read this\r\nextract\"><txp:title /></a></h3>\r\n  </txp:if_article_id>\r\n</txp:article_custom>\r\n\r\nBut then, if I'm on article list context, I get no ouput at all for any of\r\nthe two \"branches\" on the conditional tag.\r\n\r\nTag trace (for the sake of brevity, I've copied just one loop and of the\r\nabove code):\r\n\r\nbc. <txp:article_custom file_id=\"_&#37;\" section='<txp:section />' wraptag=\"ul\">\r\n\t\t[attribute 'section']\r\n\t\t<txp:section />\r\n\t\t[/attribute]\r\n\t\t[SQL (0.000875949859619): select *, unix_timestamp(Posted) as uPosted,\r\nunix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod\r\nfrom textpattern where 1=1 and Status = 4 and Posted <= now() and Section\r\nIN ('xxxxxx') and custom_1 like '_&#37;'  order by Posted desc limit 0, 10]\r\n\t\t[article 26]\r\n\t\t</txp:if_article_id>\r\n\t\t<txp:article_id />\r\n\t\t<txp:if_article_id>\r\n\t\t</txp:if_article_id>\r\n\t\t<txp:permlink />\r\n</txp:article_custom>\r\n\r\nIf you need additional info, please, tell me.\r\nThanks. What version of the product are you using? On what operating system? I'm on TXP 4.2.0 RC ( r3269 ) on Ubuntu Linux.\n\n_Original issue: http://code.google.com/p/textpattern/issues/detail?id=31_"},"comment":{"url":"https://api.github.com/repos/textpattern/textpattern/issues/comments/131356601","html_url":"https://github.com/textpattern/textpattern/issues/35#issuecomment-131356601","issue_url":"https://api.github.com/repos/textpattern/textpattern/issues/35","id":131356601,"user":{"login":"vanmelick","id":10106358,"avatar_url":"https://avatars.githubusercontent.com/u/10106358?v=3","gravatar_id":"","url":"https://api.github.com/users/vanmelick","html_url":"https://github.com/vanmelick","followers_url":"https://api.github.com/users/vanmelick/followers","following_url":"https://api.github.com/users/vanmelick/following{/other_user}","gists_url":"https://api.github.com/users/vanmelick/gists{/gist_id}","starred_url":"https://api.github.com/users/vanmelick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanmelick/subscriptions","organizations_url":"https://api.github.com/users/vanmelick/orgs","repos_url":"https://api.github.com/users/vanmelick/repos","events_url":"https://api.github.com/users/vanmelick/events{/privacy}","received_events_url":"https://api.github.com/users/vanmelick/received_events","type":"User","site_admin":false},"created_at":"2015-08-15T11:37:52Z","updated_at":"2015-08-15T11:37:52Z","body":"Lots of info lost during transfer from Google Code. Let's try that again:\r\n\r\n---\r\n\r\nReported by mani...@gmail.com, Aug 25, 2009\r\n\r\nWhen on individual article context, the following snippet work as expected:\r\nif I'm viewing article X, then article X title is not linked on the\r\ngenerated output. Great!\r\n\r\n`<txp:article_custom file_id=\"_%\" section='<txp:section />' >`\r\n`  <txp:if_article_id>`\r\n`    <h3><txp:title /></h3>`\r\n`  <txp:else />`\r\n`    <h3><a href=\"<txp:permlink />\" rel=\"bookmark\" title=\"Read this extract\"><txp:title /></a></h3>`\r\n`  </txp:if_article_id>`\r\n`</txp:article_custom>`\r\n\r\nBut then, if I'm on article list context, I get no ouput at all for any of\r\nthe two \"branches\" on the conditional tag.\r\n\r\nTag trace (for the sake of brevity, I've copied just one loop and of the\r\nabove code):\r\n\r\n`<txp:article_custom file_id=\"_%\" section='<txp:section />' wraptag=\"ul\">`\r\n`\t\t[attribute 'section']`\r\n`\t\t<txp:section />`\r\n`\t\t[/attribute]`\r\n`\t\t[SQL (0.000875949859619): 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 Section IN ('xxxxxx') and custom_1 like '_%'  order by Posted desc limit 0, 10]`\r\n`\t\t[article 26]`\r\n`\t\t</txp:if_article_id>`\r\n`\t\t<txp:article_id />`\r\n`\t\t<txp:if_article_id>`\r\n`\t\t</txp:if_article_id>`\r\n`\t\t<txp:permlink />`\r\n`</txp:article_custom>`\r\n\r\nIf you need additional info, please, tell me.\r\nThanks.\r\n\r\nWhat version of the product are you using? On what operating system?\r\nI'm on TXP 4.2.0 RC (r3269) on Ubuntu Linux.\r\n\r\n---\r\n\r\nAug 25, 2009 #1 mani...@gmail.com\r\n\r\nBTW, this is current \"workaround\":\r\n\r\n`<txp:article_custom file_id=\"_%\" section='<txp:section />' >`\r\n`  <txp:if_article_list>`\r\n`    <h3><a href=\"<txp:permlink />\" rel=\"bookmark\" title=\"Read this extract\"><txp:title /></a></h3>`\r\n`  <txp:else />`\r\n`    <txp:if_article_id>`\r\n`      <h3><txp:title /></h3>`\r\n`    <txp:else />`\r\n`      <h3><a href=\"<txp:permlink />\" rel=\"bookmark\" title=\"Read this extract\"><txp:title /></a></h3>`\r\n`    </txp:if_article_id>`\r\n`  </txp:if_article_list>`\r\n`</txp:article_custom>`\r\n\r\n---\r\n\r\nAug 25, 2009 #2 mani...@gmail.com\r\n\r\nLet me deviate a little from the original issue.\r\n\r\nThis is \"worst\" that what I would have expected. The above workaround won't work, as\r\nif_article_list inside article_custom always evaluates to true, even when on\r\nindividual_article context.\r\nIn other words, article_custom is considered a \"list\" context.\r\nTry this snippet on your page template (change \"a-section\" value for a valid section\r\non your TXP install).\r\n\r\n`<txp:if_article_list>`\r\n`this is a list`\r\n`<txp:else />`\r\n`this is an individual article`\r\n`</txp:if_article_list>`\r\n\r\n`<txp:article_custom section=\"a-section\">`\r\n`<txp:if_article_list>`\r\n`this is a list // this always evaluates to list, even if in individual article context`\r\n`<txp:else />`\r\n`this is individual article // it seems that this place can never be reached`\r\n`</txp:if_article_list>`\r\n`</txp:article_custom>`\r\n\r\nI've tested the above snippet both on 4.0.8 stable and 4.2.0 RC (r3269) and got the\r\nsame output, so I'm still asking myself it this is a bug or just how things are\r\nsupposed to work.\r\n\r\nPersonally, I consider it a bug, as it doesn't seem to fit in the \"standard\" TXP way\r\nof identifying contexts.\r\nYes, if you are \"standing\" inside an `<txp:article_custom />`, your context may be seen\r\nas a list, as article_custom returns list of articles.\r\nBut then, a common usage for `<txp:article_custom />` is to generate widgets that are\r\nboth used on both contexts (lists or individual articles). Inside those widgets you\r\nmay want to test if you are rendering it on a list or on an individual article.\r\n\r\nDoes it makes any sense?\r\nOr I'm totally confused, or this is a bug, or things changed, or I need to sleep.\r\nSorry for my english.\r\n\r\n---\r\n\r\nAug 28, 2009 #3 julian.l...@gmail.com\r\n\r\nBack to the initial issue, anyone may argue that using if_article_id outside an\r\nindividual_article context may not make any sense, and may be considered invalid. \r\n\r\nUsing it inside an individual_article context, the question means: \"is the article id\r\n(the one for current URL) equal to X? (where \"id\" attribute value defaults to current\r\narticle if not specified)\r\n\r\nUsing it inside an article_list context, the question could mean: \"on the current\r\nURL, is it there any article_id value?\" (which, of course, it should return false).\r\n\r\nA few more thoughts on all this:\r\n\r\nRegarding issue on #c2 (if_article_list being \"true\" inside article_custom, even on\r\nindividual article context), let me insist: it's a bug.\r\n\r\nRegarding if_article_id, i spotted this scenarios on different scenarios\r\n\r\nA) if_article_id on *individual_article* context:\r\n\r\nA.1) `<if_article_id>` (no id attribute) is used _outside_ an `<article_custom>` tag =>\r\nkeep current behaviour: test currently being viewed article's id against default\r\nattribute value. \r\nThis case always return true, as the id attribute defaults to currently viewed\r\narticle id.\r\n\r\nA.2) `<if_article_id id=\"X\">` is used _outside_ an `<article_custom>` tag => keep current\r\nbehaviour (test currently being viewed article's ID against \"X\"). \r\nMay return true or false.\r\n\r\nmy brain may be reaching a dead-end street below here\r\n\r\nA.3) `<if_article_id>` (no id attribute) used _inside_ an `<article_custom>` tag => keep\r\ncurrent behaviour: test article's id of current `<article_custom>` loop against a\r\ndefault value (which equals the id of the article currently being viewed). \r\nMay return true or false.\r\n\r\nA.4) `<if_article_id id=\"X\">` is used _inside_ an `<article_custom>` tag => keep current\r\nbehaviour: test article's id of current `<article_custom>` loop against \"X\". \r\nMay return true or false.\r\n\r\n(being that every point above says \"keep current behaviour\", I'm not yet sure where\r\nI'm heading to nor what's my point :P)\r\n\r\nB) if_article_id on *article_list* context:\r\n\r\nB.1) `<if_article_id>` (no id attribute) is used _outside_ an `<article_custom>` tag =>\r\nnew feature: return false.\r\n\r\nB.2) `<if_article_id id=\"X\">` is used _outside_ an `<article_custom>` tag => new feature:\r\nreturn false.\r\n\r\nB.3) `<if_article_id>` (no id attribute) used _inside_ an `<article_custom>` tag => new\r\nbehaviour: return false\r\nSee original post on this thread: currently it doesn't return nor true nor false, and\r\nworkaround on #c2 is not currently possible.\r\n\r\nB.4) `<if_article_id id=\"X\">` is used _inside_ an `<article_custom>` tag => keep current\r\nbehaviour: test article's id of current `<article_custom>` loop against \"X\". \r\nMay return true or false.\r\n\r\nOk, I'll stop by now, sorry if this is too much non-sense.\r\n"}}