We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31624
    • 17 Posts
    I am doing the Google sitemaps as covered by the sticky and by the link at http://webbake.com/tutorials/modx-cms/google-sitemap-with-ditto

    I have it 99% there except that something in this ditto call is adding this line of code below to my xml file which prevents it from parsing. Any clue what is adding it? I’ve gone though every file, the TVs, the chunk, and the sitemap.xml file and nothing appears to be wrong. It works when viewing it live but on my local test server I get this code inserted.

    <?
    // Use the following syntax $param = 'value';
    ?>
    


    This is the exact code I am using

    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
    [[Ditto? &dateFormat=`%Y-%m-%d`&startID=`0`&tpl=`google_sitemap`&displayArchive=`0`&dateSource=`editedon`&summarize=`500` &total=`500`&sortBy=`createdon`&depth=`2`&showInMenuOnly=`1`&filter=`type,document,1`]]</urlset>
    



    Thanks for any help, this is driving me loco!
      • 4041
      • 788 Posts
      Looks like that code is found in the assets/snippets/ditto/configs/default.config.php - try removing that code from that file and see if it helps.
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 36592
        • 970 Posts
        I think the short open tag (<? ... ?>) of PHP is not enabled in your environment.
        So changing it to <?php ... ?> might work.
          • 31624
          • 17 Posts
          Going to try both of those tomorrow.

          The short open tag item, that would be a part of my WAMPP installation on my server and not a part of MODx right?


          I’m glad it works on the live server but when testing its a little bit of a pain.


          Thanks
            • 27708 MODX Staff
            • 2,502 Posts
            Short open tags <? ?> vs <?php ?> is part of your php config and the default is to have it set to off on most installs as this can cause conflicts with XML. You have found the reason it is never recommended: it limits portability of code from environment to environment. <?php ?> will work on all environments but <? ?> and <% %> won’t necessarily and are there for convenience of the site owner when enabled.

            Cheers,

            Jay
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 7231
              • 4,205 Posts
              I recommend just getting in the habit of always using <?php ?>.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 31624
                • 17 Posts
                Yeah I’ve always used <?php myself however in this file I didn’t add any php code, it was inserted it itself which is odd... Hopefully when I have a free sec today I’ll use your methods above and figure this sucker out.
                  • 36592
                  • 970 Posts
                  I think you are using somewhat older version of Ditto.
                  This problem is already fixed. (rev. 3377)