{"id":776,"date":"2014-08-05T11:23:42","date_gmt":"2014-08-05T11:23:42","guid":{"rendered":"http:\/\/www.masterlevel.de\/blog\/?p=776"},"modified":"2014-08-05T11:29:51","modified_gmt":"2014-08-05T11:29:51","slug":"smarty-auf-einen-wert-einem-komplexen-array-zugreifen","status":"publish","type":"post","link":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/","title":{"rendered":"Smarty: Auf einen Wert in einem komplexen Array zugreifen"},"content":{"rendered":"<p>Letztens hatte ich ein mehrdimensionales, gemischtes Array und musste auf eine konkrete Position zugreifen.<\/p>\n<p>Sah ungef\u00e4hr so aus:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$row = 1;\r\n$col = 5;\r\n$id = 123;\r\n\r\n$array&#x5B;$row]&#x5B;'DATA']&#x5B;$col] = array(\r\n'ID' =&gt; $id,\r\n'TEXT' =&gt; &quot;test1&quot;,\r\n'TEXT2' =&gt; &quot;test2&quot;);\r\n\r\n$smarty-&gt;assign('options',$array);\r\n<\/pre>\n<p>und in smarty dann so:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n{foreach name=outer item=options_data from=$options}\r\n\r\n{if $options_data.DATA&#x5B;5].ID == 123}\r\n\/\/tu was\r\n{\/if}\r\n\r\n{\/foreach}\r\n<\/pre>\n<p>Ich glaub jetzt nicht das das jemanden hilft&#8230;aber ich hatte es mir notiert, das ich es hier in Blog schreiben m\u00f6chte.<\/p>\n<p>Well done&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Letztens hatte ich ein mehrdimensionales, gemischtes Array und musste auf eine konkrete Position zugreifen. Sah ungef\u00e4hr so aus: $row = 1; $col = 5; $id = 123; $array&#x5B;$row]&#x5B;&#8217;DATA&#8216;]&#x5B;$col] = array( &#8218;ID&#8216; =&gt; $id, &#8218;TEXT&#8216; =&gt; &quot;test1&quot;, &#8218;TEXT2&#8216; =&gt; &quot;test2&quot;); $smarty-&gt;assign(&#8218;options&#8216;,$array); und in smarty dann so: {foreach name=outer item=options_data from=$options} {if $options_data.DATA&#x5B;5].ID == 123} \/\/tu was &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,94],"tags":[],"class_list":["post-776","post","type-post","status-publish","format-standard","hentry","category-php","category-snippets"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Smarty: Auf einen Wert in einem komplexen Array zugreifen  - masterlevel<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"J. Adler\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/\"},\"author\":{\"name\":\"J. Adler\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#\\\/schema\\\/person\\\/e6868eda89eb09db99b63d9d8dd4b63f\"},\"headline\":\"Smarty: Auf einen Wert in einem komplexen Array zugreifen\",\"datePublished\":\"2014-08-05T11:23:42+00:00\",\"dateModified\":\"2014-08-05T11:29:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/\"},\"wordCount\":105,\"commentCount\":0,\"articleSection\":[\"PHP\",\"Snippets\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/\",\"url\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/\",\"name\":\"Smarty: Auf einen Wert in einem komplexen Array zugreifen - masterlevel\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#website\"},\"datePublished\":\"2014-08-05T11:23:42+00:00\",\"dateModified\":\"2014-08-05T11:29:51+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#\\\/schema\\\/person\\\/e6868eda89eb09db99b63d9d8dd4b63f\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/\",\"name\":\"masterlevel\",\"description\":\"Manche Sachen vergi\u00dft man, weil man sie nicht oft braucht - deshalb stehen sie hier...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#\\\/schema\\\/person\\\/e6868eda89eb09db99b63d9d8dd4b63f\",\"name\":\"J. Adler\",\"url\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Smarty: Auf einen Wert in einem komplexen Array zugreifen  - masterlevel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/","twitter_misc":{"Verfasst von":"J. Adler"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/#article","isPartOf":{"@id":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/"},"author":{"name":"J. Adler","@id":"https:\/\/www.masterlevel.de\/blog\/#\/schema\/person\/e6868eda89eb09db99b63d9d8dd4b63f"},"headline":"Smarty: Auf einen Wert in einem komplexen Array zugreifen","datePublished":"2014-08-05T11:23:42+00:00","dateModified":"2014-08-05T11:29:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/"},"wordCount":105,"commentCount":0,"articleSection":["PHP","Snippets"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/","url":"https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/","name":"Smarty: Auf einen Wert in einem komplexen Array zugreifen - masterlevel","isPartOf":{"@id":"https:\/\/www.masterlevel.de\/blog\/#website"},"datePublished":"2014-08-05T11:23:42+00:00","dateModified":"2014-08-05T11:29:51+00:00","author":{"@id":"https:\/\/www.masterlevel.de\/blog\/#\/schema\/person\/e6868eda89eb09db99b63d9d8dd4b63f"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.masterlevel.de\/blog\/smarty-auf-einen-wert-einem-komplexen-array-zugreifen\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.masterlevel.de\/blog\/#website","url":"https:\/\/www.masterlevel.de\/blog\/","name":"masterlevel","description":"Manche Sachen vergi\u00dft man, weil man sie nicht oft braucht - deshalb stehen sie hier...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.masterlevel.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/www.masterlevel.de\/blog\/#\/schema\/person\/e6868eda89eb09db99b63d9d8dd4b63f","name":"J. Adler","url":"https:\/\/www.masterlevel.de\/blog\/author\/admin\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts\/776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/comments?post=776"}],"version-history":[{"count":7,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts\/776\/revisions"}],"predecessor-version":[{"id":783,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts\/776\/revisions\/783"}],"wp:attachment":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/media?parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/categories?post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/tags?post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}