CodeIgniter Forums
Go to replies div on redirect - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Go to replies div on redirect (/showthread.php?tid=68264)



Go to replies div on redirect - wolfgang1983 - 06-16-2017

On my forum when a user replies to a thread / post

I am trying to be able to get it to go to that div once created.

PHP Code:
redirect(base_url('viewthread?tid=') . $tid '#' $pid); 


Code:
http://www.project.com/viewthread?tid=1#14


But for some reason will not go to the div.

It will go to div if have a space before hashtag

PHP Code:
redirect(base_url('viewthread?tid=') . $tid ' #' $pid); 

But then the url produces 

Code:
http://www.project.com/viewthread?tid=1%20#14

How can I make it go to the div with out having space in the url?


RE: Go to replies div on redirect - Paradinight - 06-17-2017

(06-16-2017, 11:49 PM)wolfgang1983 Wrote: On my forum when a user replies to a thread / post

I am trying to be able to get it to go to that div once created.

PHP Code:
redirect(base_url('viewthread?tid=') . $tid '#' $pid); 


Code:
http://www.project.com/viewthread?tid=1#14


But for some reason will not go to the div.

It will go to div if have a space before hashtag

PHP Code:
redirect(base_url('viewthread?tid=') . $tid ' #' $pid); 

But then the url produces 

Code:
http://www.project.com/viewthread?tid=1%20#14

How can I make it go to the div with out having space in the url?

1. you id field need to be unique.
2. '#' . $pid to '#pid_' . $pid and the div id to pid_xx


RE: Go to replies div on redirect - Diederik - 06-17-2017

PHP Code:
redirect(base_url('viewthread?tid=') . $tid '#' $pid); 
This? You placed the space yourself in ' #'


RE: Go to replies div on redirect - wolfgang1983 - 06-17-2017

Thanks all now working fine