ResourceBundle

31 views
Skip to first unread message

SumitP

unread,
May 25, 2017, 9:29:23 AM5/25/17
to Hippo Community
Hi All,

I am handling following scenario,

I have following URL ::  http://dummy.dummyurl.com/cat_temp=SWATCH_10%ssIm , the red highlighted part of URL is Dynamic,

I kept the URL with placeholder in resource bundle like  http://dummy.dummyurl.com/cat_temp={0}%ssIm

Question :: How can I update the dynamic value at placeholder location in front-end?
                  (currently I handled scenario by accessing Resource Bundle at backed and updating the placeholder)


Thanks and Regrads,
Sumit Pallakhe



William Borg Barthet

unread,
May 25, 2017, 9:42:35 AM5/25/17
to hippo-c...@googlegroups.com
Hi Sumit,

I'm a bit confused as to what you are trying to achieve here. The easiest way to pass information from the request URL to the template is through the HstComponent.

Your HST component can read information from a URL and set it as an attribute that can be read from the template.

One way is using a URL parameter:


HstComponent:

String catTemp = getPublicRequestParameter(request);
request.setAttribute("catTemp", catTemp);

Template:

${catTemp}

You can also match the wildcard part of the URL and pass that as a component parameter.

If you are using a wildcard sitemap item (_default_ or _any_) you can pass the part of the URL that was matched to the wildcard to the component using parameternames and parametervalues 


Sitemap:
  cat_temp
    _default_

HST Component config:
parameternames = catTemp
parametervalues = ${1}

HSTComponent:

String catTemp = getComponentParameter("catTemp");
request.setAttribute("catTemp" catTemp);

Template:

${catTemp}


Hope that helps!

William

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--

William Borg Barthet
SOLUTION ARCHITECT / TRAINER
 william.borgbarthet@bloomreach.com
+44 739 396 4977

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 71 Summer Street, Boston, MA 02110

DE +49 170 4074731
NL +31 20 522 44 66
US +1 877 414 47 76 (toll free)
www.onehippo.com
www.onehippo.org

SumitP

unread,
May 25, 2017, 10:13:46 AM5/25/17
to Hippo Community
Hi william,

I think, litlebit misunderstanding here, let me explain the scenario in depth,
I have number of products. These products having image field. and these images are coming from DAM(Digital Asset Management tool).
So we are getting these images through URL's, So I want to keep the URL in resource bundle because URL might get change in future.

But in between the URL, The Image code(red highlighted in above URL) is Dynamic, that I need to replace at front end while iterating product values.

so please suggest the way to do this.


Thanks,
Sumit P.

To post to this group, send email to hippo-c...@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.



--

William Borg Barthet
SOLUTION ARCHITECT / TRAINER
 william.borgbarthet...@bloomreach.com

William Borg Barthet

unread,
May 25, 2017, 10:31:36 AM5/25/17
to hippo-c...@googlegroups.com
Hi Sumit,

ok, in that case, maybe you can read the resource bundle value in the component and do a string replace. Incidentally, you can also do a string replace in the template (assuming ftl):

<@fmt.message key="foo"/>?replace("XXX", catTemp)

If you need the url part value to replace with, you can pass that to the component/template as I said earlier.

Hopefully that will do it.

Thanks!

William


To post to this group, send email to hippo-community@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.

SumitP

unread,
May 26, 2017, 3:09:49 AM5/26/17
to Hippo Community
Hi William,

Thanks for quick reply!!!

I resolved these issue by accessing resource bundle at backend and replaced placeholder with particular value.
But in some cases I need to replace placeholder with value in front end (Free marker template), as You told I tried  (<@fmt.message key="foo"/>?replace("XXX", catTemp) ) this way, but its not working.

please suggest!!!


Thanks in Advance,
Sumit Pallakhe.

William Borg Barthet

unread,
May 26, 2017, 3:33:27 AM5/26/17
to hippo-c...@googlegroups.com
Hi Sumit,

I guess built-ins don't work for tags, sorry about that. You can read the label in your component and set that as an attribute and use the built-in there.

HstComponent:

...
request.setAttribute("label", label);

Template:

${label?replace("XXX", catTemp);


At that point you probably might as well do the string processing in the component. There probably is a way to assign variable to, or invoke a built-in on a tag, but I can't seem to find it.

You can also invoke static methods from your template (or create your own tag).

Hope that helps

William



To post to this group, send email to hippo-community@googlegroups.com

RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.



--

William Borg Barthet
SOLUTION ARCHITECT / TRAINER
 william.borgbarthet@bloomreach.com

SumitP

unread,
May 26, 2017, 5:04:28 AM5/26/17
to Hippo Community
Hi William,

Thanks a lot for your valuable response!!!

Thanks&Regards,
Sumit P.
Reply all
Reply to author
Forward
0 new messages