![]() |
Help with looping sub categories - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Help with looping sub categories (/showthread.php?tid=35895) |
Help with looping sub categories - El Forum - 11-14-2010 [eluser]k2zs[/eluser] I am stuck here... I want to loop through sub categories in my view with the master catecory as a heading. I guess the best way to explain would be to show the code I tried: Code: <?php if (!EMPTY($SupportCategories)): ?> Please help with examples and don't treat me like an idiot, I am new to CI... Help with looping sub categories - El Forum - 11-14-2010 [eluser]k2zs[/eluser] OK... I got it to work by changes like this: Code: <?php if (!EMPTY($SupportCategories)): ?> But I'm sure there must be a cleaner way of doing it. Any suggestions? Help with looping sub categories - El Forum - 11-15-2010 [eluser]skunkbad[/eluser] You might take a look at the way I implemented the category menu in Community Cart. Category data is pulled in from the database, and it is sorted then sent to the view where it is processed by a recursive function that outputs nested lists to accommodate unlimited sub-categories. It took a lot of work to make this happen, and it could be stripped out and used in another application quite easily. Help with looping sub categories - El Forum - 11-16-2010 [eluser]k2zs[/eluser] Wow thats fantastic help, thank you. I downloaded the app and in just a few min I was able to learn so much and yet generate more questions. I was unaware that I could use pure php files as views and build the page as a variable and then echo it. It makes it so much easier to learn from a working model. One problem I am having though is with sessions. I can log in but am always challenged for username and passwod with every link I click in the admin. After I log in I see the link I clicked but forms won't process because of this. I come mainly from an old-school ColdFusion background and have always worked top-down as a flat file with all of the application code at the top. I did call includes to modularize my pages but thats been it. Been working with php for about 2 years and adopted the same style programming there. This MVC stuff is totally new to me and have only done it for about 3 weeks. Since then I have already put a site live where I've implemented a back end that works. Just last night I was able to recreate an entirely different site using my first site as a starting point and it only took about 1 hour so I am hooked now ![]() Help with looping sub categories - El Forum - 11-16-2010 [eluser]k2zs[/eluser] HA! Problem solved! I didn't change the default "mega_string".... This stuff is too cool! Help with looping sub categories - El Forum - 11-16-2010 [eluser]skunkbad[/eluser] [quote author="k2zs" date="1289969276"]HA! Problem solved! I didn't change the default "mega_string".... This stuff is too cool![/quote] Hey, glad you are having fun and figuring stuff out. Pretty much every problem a person has with my app relates to their lack of properly configuring it during installation. I'm currently working on a First Data / Linkpoint gateway, and there are a lot of changes that will be on bitbucket in a couple of weeks. Help with looping sub categories - El Forum - 11-16-2010 [eluser]skunkbad[/eluser] [quote author="k2zs" date="1289966975"]Wow thats fantastic help, thank you. I downloaded the app and in just a few min I was able to learn so much and yet generate more questions. I was unaware that I could use pure php files as views and build the page as a variable and then echo it. It makes it so much easier to learn from a working model. One problem I am having though is with sessions. I can log in but am always challenged for username and passwod with every link I click in the admin. After I log in I see the link I clicked but forms won't process because of this. I come mainly from an old-school ColdFusion background and have always worked top-down as a flat file with all of the application code at the top. I did call includes to modularize my pages but thats been it. Been working with php for about 2 years and adopted the same style programming there. This MVC stuff is totally new to me and have only done it for about 3 weeks. Since then I have already put a site live where I've implemented a back end that works. Just last night I was able to recreate an entirely different site using my first site as a starting point and it only took about 1 hour so I am hooked now ![]() I just do things my way. That doesn't mean you have to do it that way, but reflects on the flexibility of CI! |