Welcome Guest, Not a member yet? Register   Sign In
file_exists and DRY principle
#1

Hi,

i was reading the documentation here https://www.codeigniter.com/user_guide/t...pages.html
to the section "Adding logic to the controller". I think repeating ! file_exists(APPPATH.'views/pages/'.$page.'.php')) in each view does violate the DRY principle ? Confused
Reply
#2

(This post was last modified: 04-21-2019, 03:42 PM by dave friend.)

The function view($page = 'home') is a single method used to display any number of pages. Violating DRY would be to have a separate method for each possible "page" that repeats the same lines of code in each one.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB