Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
simple_sitemap
Commits
0498fe94
Commit
0498fe94
authored
Mar 04, 2016
by
Pawel G
Browse files
Showing empty page if erroreously no sitemap exists in the db instead of php error.
parent
cf7db613
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Controller/SimplesitemapController.php
View file @
0498fe94
...
...
@@ -19,7 +19,8 @@ class SimplesitemapController {
* Returns the whole sitemap, a requested sitemap chunk, or the sitemap index file.
*
* @param int $sitemap_id
* Id of the sitemap chunk.
* Optional ID of the sitemap chunk. If none provided, the first chunk or
* the sitemap index is fetched.
*
* @return object Response
* Returns an XML response.
...
...
@@ -27,6 +28,7 @@ class SimplesitemapController {
public
function
get_sitemap
(
$sitemap_id
=
NULL
)
{
$sitemap
=
new
Simplesitemap
;
$output
=
$sitemap
->
get_sitemap
(
$sitemap_id
);
$output
=
!
$output
?
''
:
$output
;
// Display sitemap with correct xml header.
// return new CacheableResponse($output, Response::HTTP_OK, array('content-type' => 'application/xml'));
...
...
src/Simplesitemap.php
View file @
0498fe94
...
...
@@ -153,10 +153,12 @@ class Simplesitemap {
// Return sitemap if there is only one chunk.
else
{
return
$this
->
sitemap
[
1
]
->
sitemap_string
;
if
(
isset
(
$this
->
sitemap
[
1
]))
{
return
$this
->
sitemap
[
1
]
->
sitemap_string
;
}
return
FALSE
;
}
}
// Return specific sitemap chunk.
else
{
return
$this
->
sitemap
[
$sitemap_id
]
->
sitemap_string
;
...
...
@@ -177,7 +179,6 @@ class Simplesitemap {
/**
* Saves the sitemap to the db.
*/
// private function save_sitemap() {
public
static
function
save_sitemap
(
$values
)
{
db_insert
(
'simple_sitemap'
)
->
fields
(
array
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment