{"id":7203,"date":"2014-05-27T09:09:12","date_gmt":"2014-05-27T09:09:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty-object-function-with-associative-array-unexpected-expected-one-of-collection-of-common-programming-errors\/"},"modified":"2014-05-27T09:09:12","modified_gmt":"2014-05-27T09:09:12","slug":"smarty-object-function-with-associative-array-unexpected-expected-one-of-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/27\/smarty-object-function-with-associative-array-unexpected-expected-one-of-collection-of-common-programming-errors\/","title":{"rendered":"Smarty Object Function with Associative Array Unexpected &ldquo;=&gt;&rdquo;, expected one of: &ldquo;&rdquo;,&ldquo;&rdquo; , &ldquo;)&rdquo;&#39;-Collection of common programming errors"},"content":{"rendered":"<p>I am having a problem with Smarty passing a PDO Object to Smarty it just doesn&#8217;t like <code>=&gt;<\/code>. Is there a trick to get around this problem?<\/p>\n<p>Here is he error:<\/p>\n<pre><code>{assign var='brgdatas' value=\"{$brgObj-&gt;fetchOneBrg(array('id'=&gt;{$ststres[ststval].to_id}'))}\"}\" - Unexpected \"=&gt;\", expected one of: \"\",\"\" , \")\n<\/code><\/pre>\n<p>Here is the code I am working with:<\/p>\n<pre><code>{section name=ststval loop=$ststres}\n\n{if $ststres[ststval].type == 2}\n\n{assign var='brgdatas' value=\"{$brgObj-&gt;fetchOneBrg(array('id'=&gt;{$ststres[ststval].to_id}'))}\"}\n<\/code><\/pre>\n<p>The correct answer Update:<\/p>\n<p>Is to add [] between the associative array and remove the quotes like so.<\/p>\n<pre><code>{assign var='brgdatas' value=$brgObj-&gt;fetchOneBrg(['id'=&gt;$ststres[ststval].to_id])}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I am having a problem with Smarty passing a PDO Object to Smarty it just doesn&#8217;t like =&gt;. Is there a trick to get around this problem? Here is he error: {assign var=&#8217;brgdatas&#8217; value=&#8221;{$brgObj-&gt;fetchOneBrg(array(&#8216;id&#8217;=&gt;{$ststres[ststval].to_id}&#8217;))}&#8221;}&#8221; &#8211; Unexpected &#8220;=&gt;&#8221;, expected one of: &#8220;&#8221;,&#8221;&#8221; , &#8220;) Here is the code I am working with: {section name=ststval loop=$ststres} {if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7203","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7203"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7203\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}