SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    . Zend_Controller_Router_Route_Regex issue

    What's wrong with this? I'm trying to set up a route in an ini file:

    Code:
    routes.category.type                = "Zend_Controller_Router_Route_Regex"
    routes.category.route               = "category/([0-9]+)/([a-z0-9\-]*)/([0-9]+)/*"
    routes.category.defaults.controller = "index"
    routes.category.defaults.action     = "category"
    routes.category.defaults.p          = 1
    routes.category.map.1               = "id"
    routes.category.map.2               = "slug"
    routes.category.map.3               = "p"
    routes.category.reverse             = "category/%d/%s/%d"
    The problem is probably with this line (if I remove it, it works fine):

    Code:
    routes.category.defaults.p            = 1
    Is there some syntax error? I'm just trying to set a variable default for "p" parameter.

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Have you tried quoting the "1"?
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it doesn't work both quoted and unquoted.

    I have just read the whole Zend documentation page dedicated to the router (http://framework.zend.com/manual/en/...er.router.html) but there is no example how to set a default value for mapped parameter so I'm just guessing the syntax.

  4. #4
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the only example they have there for combining Zend_Config and Zen_Router:

    Code:
    routes.archive.type = "Zend_Controller_Router_Route_Regex"
    routes.archive.route = "archive/(\d+)"
    routes.archive.defaults.controller = "archive"
    routes.archive.defaults.action = "show"
    routes.archive.map.1 = "year"
    ; OR: routes.archive.map.year = 1


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •