We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Hi,

    Currently, for a weblink, I have the template for getResources set up like this:


    {
    	title: '[[+pagetitle]]',
    	start: new Date([[+tv.StartDate:strtotime:date=`%Y`]],[[+tv.StartDate:strtotime:date=`%m`:subtract=`1`]],[[+tv.StartDate:strtotime:date=`%d`]]),
    	url: '[[+content]]'
    
    },



    If the page is a normal document I would like that

    url: '[[+content]]'


    changed into

    url: '[[~[[+id]]]]'



    What would be the best way to do this in Revolution?
    I was looking for a phx solution but the only thing I found is IF and I’m not sure it works.

    Maybe the easiest way is to use runSnippet in a custom snippet.

    Thx

      • 28215
      • 4,149 Posts
      I can’t remember if [[+class_key]] is set in getResources, but if it is:

      url: '[[+class_key:if=`[[+class_key]]`:is=`modWebLink`:then=`[[~[[+id]]]]`:else=`[[+content]]`]]'
      


      or in If:

      url: '[[!If? &subject=`[[+class_key]]` &operator=`EQ` &operand=`modWebLink` &then=`[[~[[+id]]]]` &else=`[[+content]]`]]'
      
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 5340
        • 1,624 Posts
        This is amazing!!!

        This works perfectly

        {
        	title: '[[+pagetitle]]',
        	start: new Date([[+tv.StartDate:strtotime:date=`%Y`]],[[+tv.StartDate:strtotime:date=`%m`:subtract=`1`]],[[+tv.StartDate:strtotime:date=`%d`]]),
        	[[+class_key:if=`[[+tv.EndDate]]`:is=``:then=``:else=`end: new Date([[+tv.EndDate:strtotime:date=`%Y`]],[[+tv.EndDate:strtotime:date=`%m`:subtract=`1`]],[[+tv.EndDate:strtotime:date=`%d`]]),`]]
        	url: '[[+class_key:if=`[[+class_key]]`:is=`modWebLink`:then=`[[+content]]`:else=`[[~[[+id]]]]`]]'
        }


        No more Evo for me grin, at least for the sites I manage.