Skip to content

STRUCTURE: {root:edit_date} variable throws an error #4745

Description

@CreativePoweredGeek

Description of the problem
While using Structure ({exp:structure:nav_advanced show_depth="4"}) to create a sitemap, I noticed that the {root:edit_date} variable throws an error

How To Reproduce
Steps to reproduce the behavior:

  1. In a template file (sitemap.group->index.html) with the type set to "XML" and template route override set to sitemap.xml

  2. add this (along with other sitemap specific headers):


{exp:structure:nav_advanced show_depth="4"}
            
                https://lifeonthesummit.com{root:page_url}
                {root:edit_date format='%Y-%m-%dT%H:%i:%s+02:00'}
                0.90
                
{/exp:structure:nav_advanced}
  1. View the page & see the error below:

Error Messages


Error Caught
Object of class DateTime could not be converted to string
ee/legacy/libraries/Localize.php:257

Stack Trace: Please include when reporting this error
#0 ee/legacy/libraries/Localize.php(90): Localize->_datetime(Object(DateTime), true)
#1 ee/legacy/libraries/Template.php(4269): Localize->format_date('%Y-%m-%dT%H:%i:...', Object(DateTime), true)
#2 ee/legacy/libraries/Template.php(4192): EE_Template->process_date(Object(DateTime), Array, false, true)
#3 ee/legacy/libraries/Template.php(3880): EE_Template->parse_date_variables('\n {!...', Array)
#4 ee/legacy/libraries/Template.php(3801): EE_Template->_parse_var_single('root:edit_date', Object(DateTime), '\n {!...')
#5 ee/legacy/libraries/Template.php(3729): EE_Template->parse_variables_row('\n {!...', Array, false)
#6 ee/ExpressionEngine/Addons/structure/mod.structure.php(2125): EE_Template->parse_variables('\n {!...', Array)
#7 ee/ExpressionEngine/Addons/structure/mod.structure.php(2132): Structure->nav_basic(true)
#8 ee/legacy/libraries/Template.php(1840): Structure->nav_advanced()
#9 ee/legacy/libraries/Template.php(1515): EE_Template->process_tags()
#10 ee/legacy/libraries/Template.php(630): EE_Template->tags()
#11 ee/legacy/libraries/Template.php(248): EE_Template->parse('{!-- ra:0000000...', false, 1, false)
#12 ee/legacy/libraries/Template.php(178): EE_Template->fetch_and_parse('', '', false)
#13 ee/legacy/libraries/Core.php(811): EE_Template->run_template_engine('', '')
#14 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#15 [internal function]: EE->index()
#16 ee/ExpressionEngine/Core/Core.php(269): call_user_func_array(Array, Array)
#17 ee/ExpressionEngine/Core/Core.php(125): ExpressionEngine\Core\Core->runController(Array)
#18 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#19 index.php(164): require_once('...')
#19 index.php(164): require_once('...')

Screenshots / Videos / Template Code

Environment Details:

  • Version: EE 7.5.8
  • PHP Version 8.3
  • MySQL Version 8
  • OS: [Linux
  • Web Server: MAMP
    Possible Solution

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions