Welcome Guest, Not a member yet? Register   Sign In
load view when a url is clicked
#1

[eluser]codecombustor[/eluser]
i am a CI newbie....
i'd like to know ---how to load view when a url is clicked ??---
#2

[eluser]terry101[/eluser]
this is a question i don't know my self. 1 way of doing it is <a href="url"> and directing it to your view page but i don't think this is the correct approach.
#3

[eluser]codecombustor[/eluser]
how about using javascript onclick when url is selected....is it a standard way to navigate pages
#4

[eluser]terry101[/eluser]
yea thats another method too but i believe when using codeigniter you can use the url helper and redirect the page that way. I haven't tried my self yet so i'm not 100% sure. i'm as new as you are in CI
#5

[eluser]jblack199[/eluser]
when a link is clicked, your link would be something like... http://www.domain.com/about/ or something like that...

you'd then have a controller for help and load your view via the controller by using $this->load->view('about');
#6

[eluser]terry101[/eluser]
ooo so for example say the controller was called "about" and the function was "go".

so i would do href = http://www.domain.com/about/go/ ?
#7

[eluser]CodeIgniteMe[/eluser]
a better approach is to use the url helper for that.

for example, you need a link for the about/go URI, you will just have to do
Code:
&lt;?php
anchor('about/go');
?&gt;
then CI will generate the complete link for you, based on the base_url you have set in your config file.

This is recommended so that your application will be portable in the event that you changed your domain or server.




Theme © iAndrew 2016 - Forum software by © MyBB