What is the recommended Approach to customize a vtl file in 2.0?

99 views
Skip to first unread message

Alex

unread,
Jun 22, 2012, 2:39:33 PM6/22/12
to dot...@googlegroups.com
Hi,

I need to customize the /static/content/content_form_macro.vtl. What
is the best approach?

a. Do it in a plugin under /Root/directory path
b. Create my own vtl and put it in my vtl folder.

Thanks,

Alex

Jorge Urdaneta

unread,
Jun 22, 2012, 2:46:07 PM6/22/12
to dot...@googlegroups.com
Option (a) looks great :)
--
Jorge Urdaneta
dotCMS developer

Maria Ahues Bouza

unread,
Jun 22, 2012, 3:55:56 PM6/22/12
to dot...@googlegroups.com
Alex,

The answer is it depends, if the macro allows to override the source code I think it's better to do this, that way you can easily update theVTL file from the Website Browser and you can have different source codes for different implementations of the same macro.

If the macro doesn't allow the override then option b works fine.

If you want to override the SubmitContent form. I would do this:

1. Save the file to the Website browser, for instance: /application/content/submit_content.vtl

2. Override the source file on the macro like this:

#set($submitContentSrc="/application/content/submit_content.vtl")
#submitContent('mystructure')

Thanks
Maria



--
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To post to this group, send email to dot...@googlegroups.com.
To unsubscribe from this group, send email to dotcms+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotcms?hl=en.




--
Community Manager

dotCMS
Main: 305.900.2001
Fax: 305.397.2579
www.dotcms.com
http://www.twitter.com/dotCMS
http://www.facebook.com/dotCMS
http://www.twitter.com/mabouza

Please consider the planet before printing this email.

Alex

unread,
Jun 22, 2012, 4:03:58 PM6/22/12
to dot...@googlegroups.com
Thanks Jorge!

I am trying to add a custom macro to the vtl file, but for some reason
my form does not display and I do not get any erros. Do you have any
ideas why? If I set it from a widget it works.

#* MODIFICATION TO SUBMIT CONTENT WITH OPEN ID AND OAUTH *#
<h2>

$text.get('org.dotcms.frontend.content.submission.login.message1')
$text.get('org.dotcms.frontend.content.sub$

$session.setAttribute("REDIRECT_AFTER_LOGIN","${VTLSERVLET_URI}?$!
{request.getQueryString()}")</h2>

#set($loginFormSourceCode = '//shared/vtl/macros/
login_macro.vtl')
#loginForm()
> --
> You received this message because you are subscribed to the Google
> Groups "dotCMS User Group" group.
> To post to this group, send email to dot...@googlegroups.com.
> To unsubscribe from this group, send email to dotcms+un...@googlegroups.com
> .

Alex

unread,
Jun 22, 2012, 4:17:35 PM6/22/12
to dot...@googlegroups.com
Nevermind! It was a cache issue. I cleared cache and everything
works as I want.

Thank YOU!

Alex

Jorge Urdaneta

unread,
Jun 22, 2012, 4:24:17 PM6/22/12
to dot...@googlegroups.com
Good to know. I was about to tell you to use dotParse to include that vtl.
http://dotcms.com/docs/2.0/DynamicIncludeOfAVtlOrHTMLFile

But if it works then don't touch it hehehe


On 06/22/2012 03:47 PM, Alex wrote:
Nevermind!  It was a cache issue.  I cleared cache and everything works as I want.

Thank YOU!

Alex
On Jun 22, 2012, at 2:03 PM, Alex wrote:

Thanks Jorge!

I am trying to add a custom macro to the vtl file, but for some reason my form does not display and I do not get any erros.  Do you have any ideas why?  If I set it from a widget it works.

#* MODIFICATION TO SUBMIT CONTENT WITH OPEN ID AND OAUTH *#
<h2>
                       $text.get('org.dotcms.frontend.content.submission.login.message1') $text.get('org.dotcms.frontend.content.sub$
                       $session.setAttribute("REDIRECT_AFTER_LOGIN","${VTLSERVLET_URI}?$!{request.getQueryString()}")</h2>

       #set($loginFormSourceCode = '//shared/vtl/macros/login_macro.vtl')
Reply all
Reply to author
Forward
0 new messages