Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Truncating an URL from a Browse field
gsal
Hello everyone,
I'm encountering a challenge with my template. In my datacapture.cfg I have a browse field called 'header'. It directs users to an image folder where they can choose an image. The url comes back as '/includesroot/images/myimage.gif'.
I sandwich this url into an image tag in my TPL using the <iw_value name="dcr.header"/> markup. However my web server's virtual mapping ignores /includesroot all together and expects the images folder to begin at the root: '/images/myimage.gif'.
How do I truncate the url so that the page is generated with '/images/myimage.gif' and not '/includesroot/images/myimage.gif'.
Find more posts tagged with
Comments
Jeremy
Use something like this to get the value of the field in an <iw_perl> block
<iw_perl>
$header = iwpt_dcr_value('dcr.header');
$header =~ s|includesroot||;
iwpt_output('<img src="bla/bla/$header">');
</iw_perl>
Try something like that.
HTH
Jeremy
Edited by Jeremy on 03/29/04 06:43 AM (server time).
gsal
Based on what you gave me, I got this to work:
<iw_perl>
<![CDATA[
$url = iwpt_dcr_value('dcr.header');
$url =~ s/\/includesroot//;
iwpt_output($url);
]]>
</iw_perl>
Thanks!
On a further note, is there another solution that will truncate the url at the datacapture.cfg file?
Jeremy
One way you would be able to truncate at the datacapture side is if you use your own browser callout, so then you can truncate before the value is returned to the DCT.
Another way would be to change it using FormAPI and maybe the onSave event to change the value just before the DCT is saved.
Have a look at your FormAPI docs at iw-home\httpd\iw\help\tst\formapi\index.html
HTH
Jeremy