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

  • Home
  • SEARCH
  • 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 6111305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:36:56+00:00 2026-05-23T14:36:56+00:00

I currently send some data as an array from my CodeIgniter controller to a

  • 0

I currently send some data as an array from my CodeIgniter controller to a view:

//Send data to template
$this->load->view('generator/content', $data);

Where $data is:

$data = array_merge($page, $posts);

I wish to modify some of the data in $posts before sending it to the view, by calling a function/method inside my library:

if (!empty($posts)) {   
    $posts = $this->my_library->modifyPosts($posts, $page_ID);
}

The stuff inside the function/method includes str_replace, exploding strings, time formatting and generally turning the data from the array into a usable format. From what I understand, it’s best to do this stuff using a library.

Is there a way I can rebuild and return the array to the controller from the library, so that when I pass the data to the view it is ready to be presented?

  • 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-05-23T14:36:56+00:00Added an answer on May 23, 2026 at 2:36 pm

    Well you should be calling the library function from the controller anyway. So in the controller you might have

    $posts = $this->my_library->modify_something($posts);

    and then your library can do it’s thing and return $posts in the new “usable format”

    Then it’s just fine from there, add the data to the $data array and pass it to your view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to send some data from and Android application to a
Currently I'm able to send some form data from an HTML page to a
I have some image data (jpeg) I want to send from my iPhone app
I'm currently writing an interface to allow applications to send exception data to a
I'm writing an API which is used to receive some data from another application.
I am currently returning JSON data like this: return new JsonResult { Data =
I have a web page which I want to send some JSON data down
I am currently trying to write some code which is going to send a
I'm writing some code to serialize some data to send it over the network.
I have a requirement to send data from native program written in C through

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.