href to display page |
(11-18-2019, 10:34 AM)dmorgan20 Wrote: I've tried this to no avail. This might sound snarky but that's not my intent. Early in the tutorial, you created an empty view function. The above adds code to that function. That seems pretty obvious since the code comes in a section called Adding logic to the controller. (OK, that is snarky. Please forgive me.) Now, to answer the question in the OP. If you have worked all the way through the Static Pages tutorial page, then you should have added a couple of $routes. (This is explained at the bottom of the tutorial page.) If that is done correctly you can browse to http://example.com/index.php and will see the "home" page. NOTE: I have added "index.php" to the URL examples here because I assume you are not using a .htaccess file that will rewrite URLs so they don't need to include "index.php". If you have set up .htaccess then you don't need to use "index.php" in the URLs as shown here. If you wanted a link on the "home" page that sends a user to the "bookings" page it would look like this. Code: <a href="index.php/bookings"><span class=""></span>BOOK NOW</a> If you have .htaccess working then the link would be Code: <a href="bookings"><span class=""></span>BOOK NOW</a> There's a bit of magic happening due to the combination of routes and the definition of Pages::view(). "bookings" is the name of the view file that winds up being the argument to view(), i.e. Pages::view('bookings'). The view file is at /application/views/Bookings.php. Hope that helps. |
Messages In This Thread |
href to display page - by dmorgan20 - 11-17-2019, 08:00 AM
RE: href to display page - by dave friend - 11-17-2019, 01:33 PM
RE: href to display page - by dmorgan20 - 11-18-2019, 10:34 AM
RE: href to display page - by dave friend - 11-18-2019, 12:23 PM
RE: href to display page - by dmorgan20 - 11-18-2019, 01:59 PM
|