$this->load->view('home_view', $data); and href=# |
[eluser]tintamarre[/eluser]
Hello, I am trying to load a view file which I do correctly in my controler using : $this->load->view('home_view', $data); but then I would like the browser to go to the anchor #contact on the form home_view.php meaning to index.php/home/#contact I have read all the documentation on the view file and so on, but I can't figure it out! The only thing I can get is : An Error Was Encountered Unable to load the requested file: /home/#contact.php This make sense because I want index.php/home/#contact I have tried several options, but I have not had any sucess yet and I can't find any subject on this on the forum. Thanks for your help! Tintamarre.
[eluser]tintamarre[/eluser]
Hello, I am open to read some part of the documentation to find out the issue - but where to look ? I have read all the documentation on codeigniter.com. I hope the only thing to do is not to change the view() function... Thanks, Tintamarre.
[eluser]xerobytez[/eluser]
You would have to do a redirect to that URL. So something like this should work. Code: redirect(site_url('home/#contact'));
[eluser]tintamarre[/eluser]
Hello, This is working, but we can't pass $_POST data and the $data array as a paramenter. So I can't retrieve my data. Is there a solution to push some data with redirect ? Thanks, T.
[eluser]tintamarre[/eluser]
Hello, just to give more information on this : Here is my function that send the email. In case of errors, I would like the screen to go to /home/#contact as the contact form is far below in my web page. I would like to avoid the user to scroll down to the form. So instead of Code: $this->load->view('header_view',$data); If would need to sth like this (but this one below is not working :-() Code: $this->load->view('header_view',$data); if I do this : Code: redirect('home#contact','refresh'); The page goes correctly to the form, I do not have the error message of my form. I am in need of this for two web sites... I have included the whole code below. Any help would be greatly appreaciated! Thanks, T. This is in the controler : Code: Function mail(){ this is in the view file : Code: <div id="contact">
[eluser]tintamarre[/eluser]
Hello, According to other sources, this should be done using javascript as view() does not support anchors. http://flesler.blogspot.com/2007/10/jqueryscrollto.html Thanks, |
Welcome Guest, Not a member yet? Register Sign In |