php - get URL id in zend framework -
i need url id particular data database in zend framework 2. controller script:
$request = $this->getrequest(); return new viewmodel( array('request' => $request));
and view:
echo $this->request;
i got output like:
get http://public.localhost.com:80/property/274 http/1.1 cookie: _ga=ga1.2.1235676771.1376588476; phpsessid=7bs59pfipit9eekd3tqmcocna3 host: public.teamleads.com connection: keep-alive cache-control: max-age=0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 user-agent: mozilla/5.0 (macintosh; intel mac os x 10_8_4) applewebkit/537.36 (khtml, gecko) chrome/29.0.1547.62 safari/537.36 accept-encoding: gzip,deflate,sdch accept-language: en-us,en;q=0.8
but, need property id, is: 274. should do?
just use getparam() method :
// $request = $this->getrequest(); return new viewmodel( array('property' => $this->getevent()->getroutematch()->getparam('property')) );
in view :
echo $this->property;
Comments
Post a Comment