Please tell me the better way to create a small site |
[eluser]jabga[/eluser]
I am creating a small brochure site. Also I am not so good in PHP. What I have is blog like paginated front page, register and login user, add, edit, delete news and Tiny MCE editor. I created a good design in it, and used it. Header, front page, single news page and other static ads etc are OK now. I am wondering how to handle menu? At the moment, they are static. Used anchor to controller functions. I would like to have a dynamic menu and other sidebar news widgets. Please suggest and teach me the right way I should go. sry about my bad english
[eluser]überfuzz[/eluser]
What features are you looking for in, lets say, the menu?
[eluser]jabga[/eluser]
Yes, the menu is static now Menu.php view is here, I guess my code will be funny for you guys. But please recommend me how to handle menu ![]() Code: echo anchor('main', 'Home page'); ?> $auth is session var ( logged or NUL) , $loggedusername is also session var $_POST['username'] came from Login page lol ![]() I found it http://www.phpeveryday.com/articles/Code...-P230.html, what is your recommendation guys?
[eluser]BrianDHall[/eluser]
To avoid duplication I do the simplest thing possible - put the menu code in its own view. Load the view into a variable, then pass that variable to my full page template that sticks the menu code in the right place. When you want to add a menu you just open that one file, add that simple line of text to a new menu item, and that's it. Done. Unless you are building a CMS of some sort, no reason not to just do it that way. Getting fancy with arrays and saving menu items in a database and all that are usually overkill. I had to go overkill in my last project when multiple nesting of categories and advanced display logic - ugh! You don't really want to bother unless you really need that, big time sink and headache.
[eluser]jabga[/eluser]
Thanks, yes my menu view is inside the header view. It's just one file like you said. Please can anyone share with me any simple codeigniter site sourse? I would like to see through code.
[eluser]jabga[/eluser]
Hi all. Here is my menu library Code: <?php Controller is here Code: $this->load->library('MyMenu'); |
Welcome Guest, Not a member yet? Register Sign In |