Welcome Guest, Not a member yet? Register   Sign In
Why are we saying SLUG = FALSE?
#4

The default for slug is FALSE, which means if no slug is passed into the method, it will still be FALSE, which makes the code retrieve ALL articles. If a slug is passed in, like http://yoursite/get_news/some-slug, then it will retrieve the INDIVIDUAL article with the slug that equals "some-slug".

So if you went to: http://yoursite/get_news
it would retrieve all articles because there is no slug provided

If you go to: http://yoursite/get_news/some-slug
it would retrieve the article with the slug of "some-slug"

Kills 2 birds with one stone, so to speak.
Reply


Messages In This Thread
Why are we saying SLUG = FALSE? - by lexxtoronto - 03-18-2015, 01:12 PM
RE: Why are we saying SLUG = FALSE? - by mwhitney - 03-18-2015, 01:25 PM
RE: Why are we saying SLUG = FALSE? - by CroNiX - 03-18-2015, 02:27 PM
RE: Why are we saying SLUG = FALSE? - by mwhitney - 03-19-2015, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB