PDA

View Full Version : Sitemap Syntax Help Please


Budget101
12-10-2016, 06:06 PM
Currently the sitemap pulls "updated dates" for the CMS from the cms_node field.

I'd like to remove the current line from the sitemap:

$content .= "\n\t" . '<lastmod>' . gmdate(DATE_W3C, $sitemap['lastmod']) . '</lastmod>';

and replace it with code that forces the <lastmod> date to be the CURRENT Date (as of the moment of sitemap generation)

Would this one work?
$content .= "\n\t" . '<lastmod>' .Y-m-d\TH:i:s+00:00. '</lastmod>';

Could someone help me out with the correct syntax please??

Dave
12-10-2016, 06:22 PM
http://php.net/manual/en/function.gmdate.php
timestamp
The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().

So if the second parameter is left out, it will default to the current time. Simply use this:

$content .= "\n\t" . '<lastmod>' . gmdate(DATE_W3C) . '</lastmod>';

Budget101
12-10-2016, 06:25 PM
http://php.net/manual/en/function.gmdate.php


So if the second parameter is left out, it will default to the current time. Simply use this:

$content .= "\n\t" . '<lastmod>' . gmdate(DATE_W3C) . '</lastmod>';


Thank you Sir!

Any idea what I should change this one to?

$data .= $l . '<lastmod>' . htmlspecialchars_uni(gmdate(DATE_W3C, $lastmod)) . '</lastmod>';

would it be this???

$data .= $l . '<lastmod>' . htmlspecialchars_uni(gmdate(DATE_W3C)) . '</lastmod>';

Dave
12-10-2016, 06:37 PM
Exactly.

Budget101
12-10-2016, 06:43 PM
Exactly.

:up: Thank you again Dave, you Rock! :up:

RichieBoy67
12-11-2016, 12:32 PM
Dave definitely rocks.