Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,150,641 members, 7,809,403 topics. Date: Friday, 26 April 2024 at 08:59 AM |
Nairaland Forum / Science/Technology / Programming / Help Fix A Codeigniter Blog Issue (1055 Views)
Having Codeigniter Issues Or Want To Learn? Contact A Codeigniter Guru / I Need Volunteers To Implement A Codeigniter Based Platform For Nigerians / Help Fix This Android Studio Error Dhtml18 And Otherd (2) (3) (4)
Help Fix A Codeigniter Blog Issue by CALEB65(m): 1:59pm On Oct 27, 2016 |
Hello geeks, I have been creating a blog using codeigniter and am almost through with the back end. I have created separate tables in my database to music file info, uploaded video file info and blog posts. I want to get this information from these 3 tables and display them on the homepage whenever an update to the database is made and I am confused on how to go about it. please help me with suggestions on what to do. thanks dhtml18 DanielTheGeek seunthomas fincoapp anybody please |
Re: Help Fix A Codeigniter Blog Issue by webdeveloperqx: 11:47pm On Oct 27, 2016 |
1. create your views, 2. create your models ( CRUD) , 3. create a controller to handle the interaction between your views and the models. ( create the method to handle the update, you can also do an ajax call to a file to get updated models(data) from the database and use a view to render it. I did not provide code samples, i believe you okay coding with codeigniter, those are the steps to follow. i hope this helps. |
Re: Help Fix A Codeigniter Blog Issue by CALEB65(m): 6:09am On Oct 28, 2016 |
webdeveloperqx:how do I get the data from the three tables and merge the into 1 page like get all the data and display them on the homepage? |
Re: Help Fix A Codeigniter Blog Issue by larisoft: 7:25am On Oct 29, 2016 |
first get the data from the database and pass it to the home view. to keep it simple, I didnt use models In your home controller, create or edit the index function to look like so function index(){ //get 10 music info $this->db->limit(0, 10); $music = $this->db->get("music_info" )->result_array(); //music info is name of table //get 10 video info $this->db->limit(10, 0); $vids = $this->db->get("video_info" )->result_array(); //video info is name of table //get 10 $this->db->limit(10, 0); $posts = $this->db->get("posts" )->result_array(); //posts is name of table $data['music'] = $music; $data['videos'] = $vids; $data['posts'] = $posts; $this->load->view("index", $data); } Now in your views, create index.php and in it you can output music like this <h1> Music Tracks </h1> <ol> <?php foreach($music as $m){ ?> <li> <?php echo $m['title'];?> <!--Note that title is the name of a column in the music_info table --> </li> <?php}?> </ol> Do same for videos and posts on the same index page. Just place each in the section of the html you will want it to appear. let me know if you meet any errors. Just wrote this here and didnt test it. |
Re: Help Fix A Codeigniter Blog Issue by Kofacts(m): 8:47pm On Oct 30, 2016 |
guess larisoft already answered your question. But just in case you can always ask for emphasis. Happy Coding.. |
(1) (Reply)
Now Available: Latest P2P Scripts / Job Vacancy For Software Developer / Network Administration / Learn Digital Marketing,blog Ads,google Adense,social Media Marketing
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13 |