Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
22 posts Page 2 of 3
Christoph, I had a look at the code and found that it does not take into account the case where Couch tables are configured to use a 'prefix' (as seems to be in your case).

To rectify the issue, please find the following line (line 85 currently) -
Code: Select all
<cms:query sql="SELECT p.modification_date FROM couch_pages p WHERE p.template_id = '<cms:show k_template_id/>'">

- and modify it to this
Code: Select all
<cms:query sql="SELECT p.modification_date FROM <cms:php>echo K_TBL_PAGES;</cms:php> p WHERE p.template_id = '<cms:show k_template_id/>'">

Hope this helps.
Thank you Kamran, that solved the problem! Have a nice day
cl wrote: I love this addon and used it in all my pages but lately i get an error on my test and live site when looking in the sitemap

"Could not successfully run query: Table 'databasenamehere.couch_pages' doesn't exist"

Any idea what i did wrong? php version is 7.1

Thank you very much!


I encountered the same error, the fix is simple

you will need to correct this code in the sitemap.php file

Code: Select all
<cms:query sql="SELECT p.modification_date FROM couch_pages p WHERE p.template_id = '<cms:show k_template_id/>'">
<cms:date "<cms:if modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show modification_date /></cms:if>" format='Y-m-d' />
</cms:query>


were is it says FROM couch_pages p WHERE p.template_id correct it to FROM couchcouch_pages p WHERE p.template_id

your final code should be as follows

Code: Select all
<cms:query sql="SELECT p.modification_date FROM couchcouch_pages p WHERE p.template_id = '<cms:show k_template_id/>'">
<cms:date "<cms:if modification_date='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else /><cms:show modification_date /></cms:if>" format='Y-m-d' />
</cms:query>


It looks like there is something that changed in the couch database system

That fixed the issue for me :)
taftaz wrote: your final code should be as follows

Yeah, but still best to let Couch provide the table name (it will always be correct that way) -
Code: Select all
<cms:query sql="SELECT p.modification_date FROM `<cms:php>echo K_TBL_PAGES;</cms:php>` p WHERE p.template_id = '<cms:show k_template_id/>'">
Guys, I'm having an issue with this code.

I keep getting the XML Parsing Error.
Code: Select all
XML Parsing Error: XML or text declaration not at start of entity
Location: https://www.relog.rs/sitemap/
Line Number 1, Column 2:
   <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="https://www.relog.rs/main-sitemap.xsl"?><urlset
--------^


Image

My sitemap.php is literally the same as the one attached in the 1st post.
Can someone help, please? Thanks!
make sure you delete all empty dashes before the xml code starts
Hey, thanks for your answer.
I did delete all of the empty dashes, and as I said - the code is literally the same as the one attached.

I'm having the same issue with simple RSS feed made as an example from the code provided in the docs, and I pasted the whole code on this link

Not sure what exactly I am doing wrong.

edit: found an issue!
My kfunctions.php had some empty space before the <?php tag
Does anyome make this addon work with the Addon for multi-lingual sites?
https://www.couchcms.com/forum/viewtopic.php?f=5&t=10979

If yes, please give advice.

Or is it common to use more then one sitemap? One for each language?

Thank you!
cl wrote: Or is it common to use more then one sitemap? One for each language?

You can use different sitemaps at once, if this helps you:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">   
        <sitemap>
            <loc>/de/sitemap.xml</loc>
            <lastmod>2020-07-15T12:03:55+02:00</lastmod>
        </sitemap>   
        <sitemap>
            <loc>/en/sitemap.xml</loc>
            <lastmod>2020-06-24T16:10:50+02:00</lastmod>
        </sitemap>   
</sitemapindex>
Thank you! I'll try it this way.
22 posts Page 2 of 3