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)
Path Issue
maggi
I have browse item in dct where the user can browse the img dir and select the image. After the select it returns something like "/img/image1.gif"
but in production it is expecting without forward slash for the img dir. for ex : "img/image1.gif".
Any thoughts/suggestions/tips to resolve this problem
Appreciate your help.
Thanks
Maggi
Find more posts tagged with
Comments
iwovGraduate
You can use FormAPI to remove the leading "/". You might want to check documentation on FormAPI.
What version of TS do you have?
maggi
TS 6.5 / Unix
Can you tell me what function I have to use in FormAPI to remove the "/" ?
Thanks
Maggi
jbonifaci
There is no function, you would write your own function to do this.
~Jeff
awizardly
I think a better way of dealing with this would be to remove the offending / in the presentation template. I am assuming you are using the dcr's by processing through a PT. The code to do that is a simple regular expression to move a leading /.
<iw_perl>
my $value = iwpt_dcr_value ('some.image.node');
$value =~ s#^/##;
</iw_perl>
<img src="{iw_value name='$value' /}" >
This leaves you with a correct path in the dcr, but you can manipulate the image path however you want when you render.
Lee
Organic Inc
http://www.organic.com
awizardly
A cleaner way to do this would be with a subroutine.
<iw_perl>
sub make_img_relative(){
my $path = shift;
$path =~ s#^/##; # Do whatever regex you want to do here.
return $path;
}
</iw_perl>
In your tag calls do
<img src="{iw_value name='make_img_relative(iwpt_dcr_value('some.image.node'))' /}">
Lee
Organic Inc
http://www.organic.com
AlunaStyles.zip