![]() |
Need help news and headlines - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Need help news and headlines (/showthread.php?tid=7489) |
Need help news and headlines - El Forum - 04-11-2008 [eluser]BaRzO[/eluser] Hi all, i need to find a way to solve this problem at admin panel user can add news categories etc. at the main page i have to show headlines ( ten headlines ) and at the below i want to shoe 11 news but which are not same the headlines i haven't find any way any idea for this sorry for pour English Need help news and headlines - El Forum - 04-11-2008 [eluser]Pascal Kriete[/eluser] Just to make sure I understand this correctly. You want to show 10 user defined headlines. And then a bunch of random news, which can be anything other than the headlines. How are you storing them and how large is the pool of articles? Need help news and headlines - El Forum - 04-11-2008 [eluser]BaRzO[/eluser] in 1 day about 50 - 70 news will be added. Not random news at the main page at the main page there is 2 box at 1st box i need to show 10 headlines and 2nd box latest 11 news but headlines and latest 11 should be not same... Need help news and headlines - El Forum - 04-11-2008 [eluser]Pascal Kriete[/eluser] Righty-o. When the user marks an article as a headline, you set a flag in the db - let's call that field is_headline. To get your headlines you do: Code: $this->db->get_where('articles', array('is_headline' => 1) ); Then to get your news you would do: Code: $this->db->where('is_headline !=', 1); Need help news and headlines - El Forum - 04-11-2008 [eluser]BaRzO[/eluser] thanks for your reply but i did this but... for example news table is like this Code: id | title | date | is_headline At this table there is 0 values this is confusing me i need 1 box whit 10 headlines and the 2nd box 11 news but this both box news must be differ and they are all new news ![]() Need help news and headlines - El Forum - 04-11-2008 [eluser]Pascal Kriete[/eluser] Now I'm confused. The ones mark your headlines. Everything with a zero isn't a headline so it's fair game for the news section. Need help news and headlines - El Forum - 04-11-2008 [eluser]BaRzO[/eluser] Code: SELECT n.news_id, n.news_title FROM news n Code: SELECT n.news_id, n.news_title FROM news n this queries looks ok but i have to collage garbage i mean user adding news but they forget to switch back to headlines N ( not ) when they are adding new news they click to headlines tick after all all news become as headlines ![]() Need help news and headlines - El Forum - 04-11-2008 [eluser]Pascal Kriete[/eluser] When they create a new headline, check how many headlines there are and if you already have 10 either display an error or simply remove the oldest. Need help news and headlines - El Forum - 04-11-2008 [eluser]BaRzO[/eluser] When user adds new news i have to use this code i think ![]() Code: UPDATE news n SET n.news_headline = 'N' where n.news_headline = 'Y' order by n.news_date DESC limit 1 |