1

I'm dumping this var but cant nail down this error:

{% set submissions = craft.tumblr.submissions %}
<ul>
    {% for key,submits in submissions %}
        // KEY GIVES ERROR 1
        <li>{{ dump(submits.key)  }}</li>
        <hr>
        // BLOG_NAME GIVES ERROR 2
        <li>{{ dump(submits.blog_name)  }}</li>
    {% endfor %}
</ul>

Error 1:

Key "key" for array with keys "blog_name, id, post_url, slug, type, date, timestamp, state, format, reblog_key, short_url, summary, recommended_source, recommended_color, followed, is_anonymous, anonymous_name, anonymous_email, is_submission, liked, note_count, title, url, link_author, excerpt, publisher, can_send_in_message, can_reply" does not exist

Error 2:

Method "blog_name" for object "Twig_Markup" does not exist

Thoughts?

EDIT: Adding scheme for craft.tumblr.submissions:

array(7) {
  [1]=>
  array(28) {
    ["blog_name"]=>
    array(1) {
      [0]=>
      string(11) ""
    }
    ["id"]=>
    array(1) {
      [0]=>
      int()
    }
    ["post_url"]=>
    array(1) {
      [0]=>
      string(64) ""
    }
    ["slug"]=>
    array(1) {
      [0]=>
      string(23) ""
    }
    ["type"]=>
    array(1) {
      [0]=>
      string(4) ""
    }
    ["date"]=>
    array(1) {
      [0]=>
      string(23) ""
    }
    ["timestamp"]=>
    array(1) {
      [0]=>
      int()
    }
    ["state"]=>
    array(1) {
      [0]=>
      string(10) ""
    }
    ["format"]=>
    array(1) {
      [0]=>
      string(4) ""
    }
    ["reblog_key"]=>
    array(1) {
      [0]=>
      string(8) ""
    }
    ["short_url"]=>
    array(1) {
      [0]=>
      string(30) ""
    }
    ["summary"]=>
    array(1) {
      [0]=>
      string(23) ""
    }
    ["recommended_source"]=>
    array(1) {
      [0]=>
      string(11) ""
    }
    ["recommended_color"]=>
    array(1) {
      [0]=>
      string(11) ""
    }
    ["followed"]=>
    array(1) {
      [0]=>
      bool(false)
    }
    ["is_anonymous"]=>
    array(1) {
      [0]=>
      bool(true)
    }
    ["anonymous_name"]=>
    array(1) {
      [0]=>
      string(13) ""
    }
    ["anonymous_email"]=>
    array(1) {
      [0]=>
      string(30) ""
    }
    ["is_submission"]=>
    array(1) {
      [0]=>
      bool(true)
    }
    ["liked"]=>
    array(1) {
      [0]=>
      bool(false)
    }
    ["note_count"]=>
    array(1) {
      [0]=>
      int(0)
    }
    ["title"]=>
    array(1) {
      [0]=>
      string(23) ""
    }
    ["url"]=>
    array(1) {
      [0]=>
      string(54) ""
    }
    ["link_author"]=>
    array(1) {
      [0]=>
      string(11) ""
    }
    ["excerpt"]=>
    array(1) {
      [0]=>
      string(11) ""
    }
    ["publisher"]=>
    array(1) {
      [0]=>
      string(11) ""
    }
    ["can_send_in_message"]=>
    array(1) {
      [0]=>
      bool(false)
    }
    ["can_reply"]=>
    array(1) {
      [0]=>
      bool(true)
    }
  }
  [2]=>
2

I'm not sure what submissions is, but submits inside your loop is an array so you can access its values using submits['blog_name'].

6
  • For submits[blog_name] the error is: Variable "blog_name" does not exist – JMP May 20 '16 at 18:25
  • What is craft.tumblr.submissions using? I can then try and replicate and test to provide a better answer. – Luke Pearce May 20 '16 at 18:26
  • @LukePearce think you were just missing the quotes in your answer. Should be submits['blog_name']. @JMP – Brad Bell May 20 '16 at 18:27
  • haha of course - that's what you get trying to work things out without code editor highlighting! – Luke Pearce May 20 '16 at 18:30
  • <li>{{ dump(submits[key]['blog_name']) }}</li> gives this error: Key "1" for array with keys "blog_name, id, post_url, slug, type, date, timestamp, state, format, reblog_key, short_url, summary, recommended_source, recommended_color, followed, is_anonymous, anonymous_name, anonymous_email, is_submission, liked, note_count, title, url, link_author, excerpt, publisher, can_send_in_message, can_reply" does not exist – JMP May 20 '16 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.