{"id":853,"date":"2015-06-25T14:51:52","date_gmt":"2015-06-25T14:51:52","guid":{"rendered":"https:\/\/www.taywa.ch\/blog\/?p=853"},"modified":"2015-06-25T14:52:57","modified_gmt":"2015-06-25T14:52:57","slug":"alle-kategorie-ids-einer-news-im-template-ausgeben","status":"publish","type":"post","link":"https:\/\/www.taywa.ch\/blog\/typo3\/alle-kategorie-ids-einer-news-im-template-ausgeben\/","title":{"rendered":"Alle Kategorie ID&#8217;s einer News im Template ausgeben"},"content":{"rendered":"<p>F\u00fcr Javascript-Filtern oder zum CSS Stylen ist es n\u00f6tig, die alle ID&#8217;s der Kategorien einer News als &#8222;genericmarker&#8220;  im template zur verf\u00fcgung zu haben. (Sei es in der listenansicht oder in der Einzelansicht).<\/p>\n<p>Als Trick behelfen wir uns mit einer Leftjoin Abfrage:<\/p>\n<div class=\"typoscript dean_ch\"><a href=\"http:\/\/www.typo3.net\/tsref\/setup\/plugin\/\"><span class=\"kw3\">plugin<\/span><\/a><span class=\"sy0\">.<\/span>tt_news<span class=\"sy0\">.<\/span>genericmarkers <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; data<span class=\"sy0\">=<\/span>uid<\/p>\n<p>&nbsp; &nbsp; CATIDS <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.typo3.net\/tsref\/cobject\/content\/\"><span class=\"kw4\">CONTENT<\/span><\/a><br \/>\n&nbsp; &nbsp; CATIDS <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; table <span class=\"sy0\">=<\/span> <span class=\"re3\">tt_news<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <a href=\"http:\/\/www.typo3.net\/tsref\/functions\/select\/\"><span class=\"kw2\">select<\/span><\/a> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectFields <span class=\"sy0\">=<\/span> <span class=\"re3\">tt_news_cat_mm<\/span><span class=\"sy0\">.<\/span>uid_foreign AS catid<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; where <span class=\"sy0\">=<\/span> <span class=\"nu0\">1<\/span><span class=\"sy0\">=<\/span><span class=\"nu0\">1<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; andWhere <span class=\"sy0\">=<\/span> uid<span class=\"sy0\">=<\/span><span class=\"br0\">&#123;<\/span>field<span class=\"sy0\">:<\/span>uid<span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; andWhere<span class=\"sy0\">.<\/span>insertData <span class=\"sy0\">=<\/span> <span class=\"nu0\">1<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftjoin <span class=\"sy0\">=<\/span> <span class=\"re3\">tt_news_cat_mm<\/span> ON <span class=\"br0\">&#40;<\/span><span class=\"re3\">tt_news_cat_mm<\/span><span class=\"sy0\">.<\/span>uid_local <span class=\"sy0\">=<\/span> <span class=\"re3\">tt_news<\/span><span class=\"sy0\">.<\/span>uid<span class=\"br0\">&#41;<\/span><\/p>\n<p><span class=\"co2\"># ACHTUNG: PID an entsprechenden Sysfolder anpassen:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pidInList <span class=\"sy0\">=<\/span> <span class=\"nu0\">2<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; max <span class=\"sy0\">=<\/span> <span class=\"nu0\">10<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; renderObj <span class=\"sy0\">=<\/span> <a href=\"http:\/\/www.typo3.net\/tsref\/cobject\/text\/\"><span class=\"kw4\">TEXT<\/span><\/a><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; renderObj<span class=\"sy0\">.<\/span>field <span class=\"sy0\">=<\/span> catid<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; renderObj<span class=\"sy0\">.<\/span>noTrimWrap <span class=\"sy0\">=<\/span> <span class=\"sy0\">|<\/span>c<span class=\"sy0\">|<\/span> <span class=\"sy0\">|<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><\/div>\n<p>Nun kann man den Marker GENERIC_CATIDS im tt_news Template verwenden. zB so:<\/p>\n<div class=\"html dean_ch\">\n&lt;div class=&quot;news-list-item ###GENERIC_CATIDS###&quot;&gt;<br \/>\n&nbsp;<\/div>\n","protected":false},"excerpt":{"rendered":"<p>F\u00fcr Javascript-Filtern oder zum CSS Stylen ist es n\u00f6tig, die alle ID&#8217;s der Kategorien einer News als &#8222;genericmarker&#8220; im template zur verf\u00fcgung zu haben. (Sei es in der listenansicht oder in der Einzelansicht). Als Trick behelfen wir uns mit einer Leftjoin Abfrage: plugin.tt_news.genericmarkers &#123; &nbsp; &nbsp; data=uid &nbsp; &nbsp; CATIDS = CONTENT &nbsp; &nbsp; CATIDS<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,136,4],"tags":[39,181],"class_list":["post-853","post","type-post","status-publish","format-standard","hentry","category-typo3","category-typo3-6","category-typoscript","tag-ausgeben","tag-typoscript"],"_links":{"self":[{"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":6,"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":859,"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions\/859"}],"wp:attachment":[{"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.taywa.ch\/blog\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}