tell a friend project |
[eluser]kierownik[/eluser]
Hi all, I started a project with codeigniter to get familiar with it so I choose to make a tell a friend controller and view. Now I do not want to use a database and keep it flatfile based. Now I know how to write the time to my log-file but it seems it does not get updated. Could someone tell me what I am doing wrong! If you have any remarks on the coding side I love to hear it, I am here to learn to program correctly. The Code: Controller: tell_a_friend.php http://www.pastebin.com/f718db868 View: tell_a_friend_view.php http://www.pastebin.com/f2f6af688 I Could not post the code here, it was to long I think. Thanks,
[eluser]kierownik[/eluser]
Nobody :long: Now I was thinking in using just one file and make an array in that file. Code: $tellafriend = array( What would the best approach be to get the best result. I hope someone can help me.
[eluser]SpooF[/eluser]
I would use a single file, store each record on its own line in the format: {name|email|friendemail|ip}, you dont even need to place them on there own lines. Then to get your results you can simple read the file and use a preg match to find the information you need. Or do it via XML, which would probably be the better solution.
[eluser]kierownik[/eluser]
I will look into that thank you. I do not have any clue how to do it but I am going to try it.
[eluser]slowgary[/eluser]
The easiest way might be to create a multidimensional array just as you have, and use PHP's serialize() function to turn the array into a string, then store it to file. To retrieve it, just read in the string and unserialize() it. Easy.
[eluser]kierownik[/eluser]
I now made one that uses a database. I will now try to make one that is flatfile based. I will try to use the suggestions that you all made.
[eluser]kierownik[/eluser]
I have submitted my script to the wiki. The page can be found here: http://codeigniter.com/wiki/tellafriend/
[eluser]zibstefan[/eluser]
add $this->output->enable_profiler(FALSE); to the method ajax_index() |
Welcome Guest, Not a member yet? Register Sign In |