/** * Populate a sitemap using a Doctrine entity. * * @param Sitemap $sitemap The current sitemap. */ public function populate(Sitemap $sitemap) { $query = $this->getQuery($this->options['entity'], $this->options['query_method']); $results = $query->iterate(); // and populate the sitemap! while (($result = $results->next()) !== false) { $sitemap->add($this->resultToUrl($result[0])); $this->em->detach($result[0]); } }
public function populate(Sitemap $sitemap) { foreach ($this->options['routes'] as $route) { $route = array_merge($this->defaultRoute, $route); $url = new Url(); $url->setLoc($this->router->generate($route['name'], $route['params'])); $url->setChangefreq($route['changefreq'] ?: $this->options['changefreq']); $url->setLastmod($route['lastmod'] ?: $this->options['lastmod']); $url->setPriority($route['priority'] ?: $this->options['priority']); $sitemap->add($url); } }
/** * Populate a sitemap using a Propel model. * * @param Sitemap $sitemap The current sitemap. */ public function populate(Sitemap $sitemap) { $query = $this->getQuery($this->options['model']); // apply filters on the query foreach ($this->options['filters'] as $filter) { $query->{$filter}(); } // and populate the sitemap! foreach ($query->find() as $result) { $sitemap->add($this->resultToUrl($result)); } }
public function populate(Sitemap $sitemap) { $url = new Url(); $url->setLoc('http://www.google.fr'); $url->setChangefreq(Url::CHANGEFREQ_NEVER); $url->setLastmod('2012-12-19 02:28'); $video = new Video(); $video->setThumbnailLoc('http://www.example.com/thumbs/123.jpg'); $video->setTitle('Grilling steaks for summer'); $video->setDescription('Alkis shows you how to get perfectly done steaks every time'); $url->addVideo($video); $sitemap->add($url); $url = new Url(); $url->setLoc('http://github.com'); $url->setChangefreq(Url::CHANGEFREQ_ALWAYS); $url->setPriority(0.2); $sitemap->add($url); }
public function populate(Sitemap $sitemap) { $url = new Url(); $url->setLoc('/search'); $sitemap->add($url); }