Easiest way to parse update data? |
[eluser]Kola[/eluser]
I've been toying around with confirmation messages. Basicly I have a language file containing success/error messages, these are called with a function. Code: <?php Basicly this produce: Succes/Error: Some message depending on the uri segment 5. Ex (db_update_success). I initially sent this with a redirect: Code: redirect('admin/view/contact/success/db_update_success'); controller/method/site_to_load/update_message_keyword/update_message_language_file_keyword. This however proved to give me some other issues. I happen to have a textarea on the page also. In order to keep the textarea up-to-date my textarea is coded like this: Code: <?php The variable $contact_text is currently just hardcoded 'placeholder', but on my other pages I receive this variable from my view controller, through $data['key'] = 'information I want parsed through'; But I can't see a solution to sending both of these data sets through. I had plenty issues with my view method being called when needed, and when not needed (often resulting in loops of 2 views being loaded), which was the reason I made the page-selection URI based. This was largely due to my view being loaded in my index() function, and in the respective method in use. My solution was, as said, the above, aswell as simply making my index() do nothing, and make the method in use sole-owner of the View method, that way it only ever got called once. Code: function View() So basicly to cut it short (guess some may be confused due to the above mess, hard to explain in words): What is the optimal way of making a View-load controller, so you can parse the data in you want, without having the view loaded multiple times?
[eluser]cahva[/eluser]
Yeah, didnt understand the mess so skipped to the end ![]() Basicly its always good to do a redirect after succesfull update so that user cant repost the form. Why do you want to use the url to tell you what error(or success) messages you want to display? Flashdata is the best way to go when you want to show success messages(after redirect from succesfull update for example). Otherwise for the errors in form you would use form validation library's error messages. I see that you dont take advantage of form validation class. Please do as it will partially solve your problem(language, showing error messages). |
Welcome Guest, Not a member yet? Register Sign In |