Code Question |
Hello, I have a model function that I have been working on every thing seems to be working fine
I would like to no should I make a if statement for my return base_url() at the bottom of page. If so what would you recommend? PHP Code: <?php
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Hi,
You should check it has been set before generating a URL with it. I would have made this into a helper. If called I would return simply either TRUE or FALSE if resized image was created. I would also have put the location of the image either as a config item, or an option in the method. Within this helper I would also have another function called something like 'show_image', which checks that the image exists, and returns a url to it. But, not the base_url bit, that part is for the view to add. If it did not exist, it could then call the function above to create the image as a private function. I also always follow the naming convention of adding _model, _view, _helper to the end of my class names. So your model here would be Image_resize_model.php However, that is all opinion, as naming conventions are not enforced, and the beauty of CI is you can do it however you want. Good job though, Paul. |
Welcome Guest, Not a member yet? Register Sign In |