Hostile Posted March 21, 2009 Share Posted March 21, 2009 Hello, I'm working on a CMS that I'll be using for a site in the near future. However, I'm stuck on a feature that I want to add into the admin panel. To explain what I have so far, I have code that gets the sub directories (the actual themes) in my "themes" folder of the CMS. It lists these themes in a table with the themes' names, a screenshot, and a radio button at the bottom for the admin to select them. What I want to do with this code is make it so it only lists 4 themes per table. If they're are more than 4, I would like it to create a whole new table.. and repeat this process until all the themes are listed. Here is my code so far: http://pastebin.com/mc5df58b Quote Link to comment https://forums.phpfreaks.com/topic/150417-im-a-little-stuck-on-this/ Share on other sites More sharing options...
Hostile Posted March 21, 2009 Author Share Posted March 21, 2009 EDIT: I realize there are a few typo's in my pastbin link above, so I reposted: http://pastebin.com/m251ceb5 Quote Link to comment https://forums.phpfreaks.com/topic/150417-im-a-little-stuck-on-this/#findComment-789989 Share on other sites More sharing options...
GingerRobot Posted March 21, 2009 Share Posted March 21, 2009 Well you'll just need to keep track of the number of themes you've shown and if it's divisible by 4, close off the current table and create a new one. Quote Link to comment https://forums.phpfreaks.com/topic/150417-im-a-little-stuck-on-this/#findComment-790069 Share on other sites More sharing options...
Maq Posted March 21, 2009 Share Posted March 21, 2009 Hint: You can use the modulus operator to see if it's divisible by 4. Keep a counter in the loop and when: if(($count % 4) == 0) { //create new table } Quote Link to comment https://forums.phpfreaks.com/topic/150417-im-a-little-stuck-on-this/#findComment-790072 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.