• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stuck at tutorial - "Adding logic to the controller"

Hello, I wanted to learn a PHP framework and started with CI today, but I got stuck at the tutorial about static pages.
The subchapter "Adding logic to the controller" wants me to add a check - I assume to add it into a controller - that the page to be loaded actually exists.

Tutorial says: "In order to load those pages, you’ll have to check whether the requested page actually exists: "
PHP Code:
public function view($page 'home')
       if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))
               // Whoops, we don't have a page for that!

       $data['title'] = ucfirst($page); // Capitalize the first letter


But I can't figure out where this code goes. In my controllers folder, there is pages.php and welcome.php.

Thank you for your help Blush

Messages In This Thread
Stuck at tutorial - "Adding logic to the controller" - by 00253 - 02-25-2017, 04:01 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.