newbie need ur help!! |
[eluser]wissal[/eluser]
Hi im new to codeigniter and to mvc i need to create a website and im having trouble starting i want to have a menu on the first page (home) , it would be something like this : +home +services +products +contact +login |_sub menu1 |_sub menu2 i have already followed a tutorial and created a login page which call my home page.. when i try to call another page from the home it says this page does not exist although i have it in my views,for that i used load->view i also used the normal <a > and anchor!! and in the url i get localhost/c/index.php/login/home i dont know why i get login i should not i think this is why it says it doesnt exist.. now i need to start with home page and have the login page in the menu like i showed u, my problem is that i dont know how to add links so i can navigate between the pages..plz help me, i need to find a solution today i hope i was clear plz bare with me and explain to me step by step thanks
[eluser]iConTM[/eluser]
A quick solution could be this: Code: $menu = array( for the HTML: Code: <ul class='menu'>
[eluser]wissal[/eluser]
i already have a template with the menu ready and all the pages, and a js script for sub menus..all i need is how to add the links so i can naviguate between my pages using <a > didnt work for me i dont know why!
[eluser]iConTM[/eluser]
Code: <a href="<?php echo base_url() ?>controller/class/param1">link</a> is your .htaccess file configured correctly? Code: RewriteEngine on
[eluser]wissal[/eluser]
im testing in local , i dont have the .htaccess in local i dont really understand how it works exactly, i used it just to add a password on the page..so i didnt understand what u wrote anyway here is what i have in it on the server: Code: Options -Indexes what do u mean by param1 ?? Code: <a href="<?php echo base_url() ?>controller/class/param1">link</a>
[eluser]iConTM[/eluser]
well i'm not a .htaccess hero either :p did you try to set 'index.php' in the url you want to access? e.g.: http://localhost/index.php/hello I know that you can define which directories or files can be accessed or not by the user. This is a verry important file when setting up CI. here are some interesting links about this: http://ellislab.com/codeigniter/user-gui.../urls.html http://opinionatedcoder.wordpress.com/20...-htaccess/ the function parameters can be passed by url e.g. Code: <a href="<?php echo base_url() ?>home/article/15">link</a> home = controller article = method 14 = param for article method (optional) Code: function article ($id) Quote:and why would i point to the controller while i want to load the view and my page is in the view folder?? This is how CI works: the view is loaded within each controller each controller can be accessed by the url it's all explained in the userguide
[eluser]wissal[/eluser]
thank you i will look at the links u gave me tomorrow morning i tried to put the index directly in the url but didnt work "the view is loaded within each controller..each controller can be accessed by the url" i know that.. so u mean that i should create a controller for each view i have so i can load it from there,right? so many controllers/files for all the views i have with just the load function in each of them!!
[eluser]iConTM[/eluser]
you can load multiple views in one controller. you can see a controller as a category or directory Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |