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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

creating a hrdcoded image link with a feild

Go to End

3 Posts   1102 Views


Community Member, 78 Posts

8 July 2008 at 1:58am

I have two advert images on a website homepage which are displayed by two image uploaders and I have also created two text feilds where I want to put an external website address. Is it possible, within the to use the textfeilds to link the image? Here is what i have:

<a href="http://$Left_Advert_Website">$Left_Advert</a>

$Left_Advert_Website is the text feild for the site
$Left_Advert is the image

However when i hover over the image it displays" http:/// and on clicking I get the message: "The URL is not valid and cannot be loaded"

Am i trying to do the impossible or is there anyway of resolving this issue - ideally i do not want to hard code the URL


Forum Moderator, 5523 Posts

8 July 2008 at 12:40pm

Edited: 08/07/2008 12:42pm

Yep it is certainly possible to do - $Left_Advert_Website probably hasnt been correctly saved. What you might have to do is wrap the variable in a {} to prevent it being interpreted as $Left_Advert_Website".. so you would have <a href="http://{$Left_Advert_Website}">. But first off you need to make sure Left_Advert_Website exists


Community Member, 78 Posts

8 July 2008 at 8:48pm

OK im a noob!
When creating the fields I first build the imagefeilds so that I could work on the visuals and get the page styling right. When it came to creating the textfeilds my natural instinct put them with the imagefeilds in the static $has_one = array rather than static $db = array. Whoops!

Thanks for your help willr