Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CodeIgniter]Przetrzymanie danych.., .. Wyszukiwarka.
kajzur
post
Post #1





Grupa: Zarejestrowani
Postów: 385
Pomógł: 26
Dołączył: 22.03.2008
Skąd: TM

Ostrzeżenie: (0%)
-----


Wiem, troszkę dziwny tytuł (IMG:style_emoticons/default/winksmiley.jpg) Robie w CI wyszukiwarkę, wraz z paginacją. No i mam problem, jak przedłużyć "życie" danych wpisawny w polu szukaj..

POST - Ginie po przejściu na nast stronę.

GET -
Cytat
GET data is simply disallowed by CodeIgniter since the system utilizes URI segments rather than traditional URL query strings (unless you have the query string option enabled in your config file). The global GET array is unset by the Input class during system initialization.


Po ustawieniu

Cytat
$config['enable_query_strings'] = true;


Mam dostęp do GET, ale wtedy po przejściu na nast. stronę, paginacja nadpisuje szukaną wartość, numerem strony.. Więc też nie działa.. ;/

Sesja - Po przejściu na następną stronę, nadpisuje zmienną, i zamiast szukać frazy, szuka pustego pola.. ;/

Any idea? ;>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kajzur
post
Post #2





Grupa: Zarejestrowani
Postów: 385
Pomógł: 26
Dołączył: 22.03.2008
Skąd: TM

Ostrzeżenie: (0%)
-----


Cytat
Ya I agree with devbro on how to do it but I would set a flashdata session instead of a regular session then just reset it when they go to the next page. that way if they leave the search pages they don’t have any unnecessary session data.

Atleast that how I do it.

Identycznie u mnie reaguje na sesje...

Niby problem rozwiązałem:

  1.  
  2. function search()
  3. {
  4.  
  5. $this->load->library('pagination');
  6. $this->load->model('cytat');
  7.  
  8.  
  9.  
  10. $tekst['artysci'] = $this->cytat->get_artists();
  11. $tekst['users'] = $this->cytat->get_users();
  12.  
  13.  
  14. if($this->input->post('search') == 'yes')
  15. {
  16.  
  17. $newsite = site_url().$this->uri->uri_string().'/'.$this->input->post('phrase');
  18. redirect ($newsite, 'location');
  19. }
  20. if($this->uri->segment(3) != '')
  21. {
  22. $config['base_url'] = site_url().'/cytaty/search/'.$this->uri->segment(3).'';
  23. $config['total_rows'] = $this->cytat->getSResults_num($this->uri->segment(3));
  24. $config['per_page'] = '4';
  25. $config['uri_segment'] = '4';
  26. $config['full_tag_open'] = '<p align = "center">';
  27. $config['full_tag_close'] = '</p>';
  28. $config['next_link'] = 'Dalej';
  29. $config['prev_link'] = 'Wstecz';
  30. $this->pagination->initialize($config);
  31.  
  32. if(!$this->uri->segment(4))
  33. $lol = 0;
  34. else
  35. $lol = $this->uri->segment(4);
  36.  
  37. $tekst['dane'] = $this->cytat->getSResults($this->uri->segment(3), $config['per_page'], $lol);
  38. }
  39. $this->load->view('bzdety', $tekst);
  40.  
  41. }

Co zrobiłem? Ano, odebrałem, to po user wpisał w pole, stworzyłem z tą frazą, nowy url, i przekierowałem na niego..

Widzicie jakieś zagrożenie dla takiego rozwiązania?

1. Problem z polskimi znakami - próbowałem przez base64 lecz nie działało - nie upoważnione znaki - po przeszukaniu Internetu, pogrzebałem trochę w uri.php i teraz mam linki w postaci np http://localhost/~cyt/index.php/cytaty/search/miłość - co ciekawe, polskie znaki w adresie działają (IMG:style_emoticons/default/winksmiley.jpg)

Jakie inne zagrożenia widzicie?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.12.2025 - 11:22