cancel
Showing results for 
Search instead for 
Did you mean: 

whats wrong in this code?

jeyush
Champ in-the-making
Champ in-the-making
I write one .js file but when i run that script it is not show me the content of that particular file.can anybody know where i am wrong ? any help appreciated .

my content.get.js look like this



var tutorial = companyhome.childByNamePath("/Guest Home/
Brochure.xsd");
document.tutorial = tutorial;
formfield.content = document.properties.content;
cache.ETag = tutorial.properties.content;
cache.lastModified = tutorial.properties.modified;


And my content.get.ftl look like this


${document.properties.content}


Thx in advance.
6 REPLIES 6

mikeh
Star Contributor
Star Contributor
Please see my reply to your other post.

Part of your problem is that you seem to be mixing client-side javascript with server-side javascript. What are you expecting document, formfield and cache objects to represent?

Try this instead:

content.get.js
var tutorial = companyhome.childByNamePath("/Guest Home/Brochure.xsd"); 
model.tutorial = tutorial;
content.get.html.ftl
${tutorial.properties.content}

Thanks,
Mike

jeyush
Champ in-the-making
Champ in-the-making
Thx mike , for your reply.

But i want to display whole content of that file

So what should i do ? now

content.get.js contains

var tutorial = companyhome.childByNamePath("/Guest Home/qwer.txt");
model.tutorial = tutorial;


and

content.html.ftl contains

${tutorial.properties.content}



OUTPUT:
org.alfresco.repo.template.BaseContentNode$TemplateContentData@11043d2

I dont understand this output.so can u guide me towards the right solution.please

bye Mike

mikeh
Star Contributor
Star Contributor
Sorry, that should be

content.get.html.ftl
${tutorial.content}

Thanks,
Mike

jeyush
Champ in-the-making
Champ in-the-making
Hurreeyyy It is working .Thank you very much Mike

jeyush
Champ in-the-making
Champ in-the-making
When i write "text" as a format in .desc file at that time, the content of that file are display , but when i chane it to "html" then it is not display.I tried but it is not enough to do right.

So my que is what i do to display that content in html format or any other format?

When i change in desc file format(for html) at that time my file exe is content.get.html.ftl
And when i write format (for text) at that time my exe is content.get.txt.ftl

but nothing goes right.

pls help me…I am waiting..

mikeh
Star Contributor
Star Contributor
I suspect it's not being displayed because it's an .XSD. Try "View Source" on the web page.

Freemarker has a built-in called "html" which will encode the output if that's what you need.

Thanks,
Mike