Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

baseURL in literalField


Reply


2 Posts   288 Views

Avatar
merrick_sd

Community Member, 97 Posts

23 August 2013 at 11:55pm

what should it be to include the BaseURL in some text in the CMS like on a literal field

$fields->addFieldToTab("Root.Main", new LiteralField (
"literalfield",
"<p>Download Example Banner <a href=\"/".Director::absoluteBaseURL()."/BannerModule/images/examples/770x314.zip\" target=\"_blank\" >Example Banner Image 770 x 314px [zip]</a></p>"
));

this come out whithe the domainname twice!!!

http://dev.mydomain.co.uk/http://dev.mydomain.co.uk//lBannerModule/images/examples/770x314.zip

Avatar
merrick_sd

Community Member, 97 Posts

24 August 2013 at 12:01am

solution

$fields->addFieldToTab("Root.Main", new LiteralField (
"literalfield",
"<p>Download Example Banner <a href=\"/BannerModule/images/examples/770x314.zip\" target=\"_blank\" >Example Banner Image 770 x 314px [zip]</a></p>"
));