Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8715619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:53:25+00:00 2026-06-13T05:53:25+00:00

In this http://codeigniter.com/user_guide/libraries/parser.html tutorial we have this multidemensional array $data = array( ‘blog_title’ =>

  • 0

In this http://codeigniter.com/user_guide/libraries/parser.html tutorial we have this multidemensional array

$data = array(
          'blog_title'   => 'My Blog Title',
          'blog_heading' => 'My Blog Heading',
          'blog_entries' => array(
                                  array('title' => 'Title 1', 'body' => 'Body 1'),
                                  array('title' => 'Title 2', 'body' => 'Body 2'),
                                  array('title' => 'Title 3', 'body' => 'Body 3'),
                                  array('title' => 'Title 4', 'body' => 'Body 4'),
                                  array('title' => 'Title 5', 'body' => 'Body 5')
                                  )
        );

And we printing him easily like this

{blog_entries}
    <h5>{title}</h5>
    <p>{body}</p>
{/blog_entries}

But how to output array like this one https://i.stack.imgur.com/WniLT.png 😕

 $data = array( 
array(
    'user' => array('id' => "1", 'name' => "Test1"
    ),'title' => 'Title 1', 'body' => 'Body 1'),
array(
    'user' => array('id' => "2", 'name' => "Test2"
    ),'title' => 'Title 2', 'body' => 'Body 2'),
array(
    'user' => array('id' => "3", 'name' => "Test3"
    ),'title' => 'Title 3', 'body' => 'Body 3')
);

If we trying to do something like this

{blog_entries}
    {user}
        {id}
    {/user}
    {title}
    {body}
    <br />
{/blog_entries}

We ll have error:

Message: Invalid argument supplied for foreach()

Ah, found similar problem here Extended Template Parser: CodeIgniter… Issue with Nested Arrays

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:53:26+00:00Added an answer on June 13, 2026 at 5:53 am

    Setup your array more like this

    $data = array( 'user' => array('id' => "1", 'name' => "Test1", 'title' => 'Title 1', 'body' => 'Body 1'),
                             array('id' => "2", 'name' => "Test2", 'title' => 'Title 2', 'body' => 'Body 2'),
                             array('id' => "3", 'name' => "Test3", 'title' => 'Title 3', 'body' => 'Body 3')
    );
    

    And after that, it’s kind of like nesting HTML tags, except with key->value pairs in a PHP (If that make sense).

    {user}
        <h4>{name} : {id}</h4>
        <span>{title}</span>
        <p>
            {body}
        </p>
    {/user}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this tutorial on CodeIgniter: http://ie.mirror.twsweb-int.com/codeigniter/user_guide/tutorial/index.html 4th page of tutorial: http://ie.mirror.twsweb-int.com/codeigniter/user_guide/tutorial/create_news_items.html In the
I try add example from http://ellislab.com/codeigniter/user_guide/tutorial/news_section.html to my site, this is code: news_model <?php
Question about this helper http://codeigniter.com/user_guide/helpers/download_helper.html If, for example, program.exe weights 4 GB, will it
For Security reasons as mentioned here http://codeigniter.com/user_guide/installation/index.html I have placed the system and application
Following from this tutorial.. http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-6-login/ I have successfully implemented and created/logged in users.. I
I'm new to code igniter. I'm following the form validation tutorial found at: http://www.codeignitor.com/user_guide/libraries/validation.html
I'm using CodeIgniter's built in sessions, not PHP sessions (read more: http://codeigniter.com/user_guide/libraries/sessions.html ). I
I followed this tutorial here: http://www.dannyherran.com/2011/02/facebook-php-sdk-and-codeigniter-for-basic-user-authentication/ It works great but when I enable CSRF
How can I hide the parameters in Codeigniter? I have this URL: http://example.com/profile/1 I
I followed this tutorial: http://codeigniter.com/wiki/Internationalization_and_the_Template_Parser_Class/ The controller that loads the language is this one:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.