ratherblue / freemarker-debugger

Debugging in Freemarker made easy.
MIT License
36 stars 7 forks source link

Unable to debugObjects #3

Open evilgeniuscreative opened 7 years ago

evilgeniuscreative commented 7 years ago

Hi, I'm not sure if this is the right procedure to ask for help here ... but, here goes. If not, please direct me to the right place.

I am trying to use this to expand mystery objects in Freemarker in Lithium. There must be something I'm missing in the ReadMe instructions...

Here is my implementation:

`<#import "debugger.ftl" as debugger />

<#assign pcQuery = "SELECT id,view_href FROM categories WHERE depth = 2 AND parent_category.id = 'private-support'"/> <#assign pcData = rest("2.0", "/search?q=" + pcQuery?url).data.items![]/>

<#assign settings = { "styleClassPrefix": "freemarker-debug", "queryParamKey": "debugTable", "includeStyles": false, "ignoredKeys": ["class"], "ignoredPatterns": ["org.springframework."] } />

<@debugger.debugTable debugObject = pcData depth = 0 />`

Result: ERROR InvalidReferenceException:The following has evaluated to null or missing: ==> RequestParameters [in template "debugger.ftl" at line 48, column 24] which is <#assign debugQuery = (RequestParameters[settings.queryParamKey]!'')?trim />

I want to get a result of the expanded object, as if it were, say, JSON. Help? Thanks!

ratherblue commented 7 years ago

Hey there! I haven't looked at this in awhile but I think you need to add ?debugTable to your url (or remove queryParamKey from the settings). The queryParamKey is for if you're going to enable the debugger in a live site and want to prevent someone from casually guessing the debug url.

And yea, I think the README could use some more info. Lmk if tbat works!

On Mon, Oct 30, 2017 at 2:29 PM Ian Kleinfeld notifications@github.com wrote:

Hi, I'm not sure if this is the right procedure to ask for help here ... but, here goes. If not, please direct me to the right place.

I am trying to use this to expand mystery objects in Freemarker in Lithium. There must be something I'm missing in the ReadMe instructions...

Here is my implementation:

`<#import "debugger.ftl" as debugger />

<#assign pcQuery = "SELECT id,view_href FROM categories WHERE depth = 2 AND parent_category.id = 'private-support'"/>

<#assign pcData = rest("2.0", "/search?q=" + pcQuery?url).data.items![]/>

<#assign settings = {

"styleClassPrefix": "freemarker-debug",

"queryParamKey": "debugTable",

"includeStyles": false,

"ignoredKeys": ["class"],

"ignoredPatterns": ["org.springframework."]

} />

<@debugger.debugTable debugObject = pcData depth = 0 />`

Result: ERROR

InvalidReferenceException:The following has evaluated to null or missing:

==> RequestParameters [in template "debugger.ftl" at line 48, column 24]

which is <#assign debugQuery = (RequestParameters[settings.queryParamKey]!'')?trim />

I want to get a result of the expanded object, as if it were, say, JSON. Help? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ratherblue/freemarker-debugger/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8omNnig-kA9RZ-rUNvj0Rn98ZuGbyEks5sxj-1gaJpZM4QL4dT .

evilgeniuscreative commented 7 years ago

Thanks for the reply!

Hm. Sadly, still getting the same error.

Bottom line is that I want to be able to generate a JSON-looking structure from a Freemarker object and I'm relatively new to it. Any advice you can give me either in using this code or a piece of it?

Thank you!

evilgeniuscreative commented 7 years ago

Looks like there's an issue with the Freemarker configuration on our server; thanks tho