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.
In the Page.php file - this is all working
public static $has_one = array(
"BackgroundImage" => "Image"
$fields->addFieldToTab("Root.Content.OptionalHeaderImage", new ImageField("BackgroundImage", "Background Image:"));
In my template, I would like only the image path, but the system return this...
background-image:url(<img src="/assets/Backgrounds/blue-star/bg-body.jpg" alt="blue star" />);
How do I get just the path and file only?
Add the .URL onto your control and it returns only the path.
On another issue, can I refine this even further?
What I need now is just the file name only?
I need the "filename.jpg"
Nope! It would be nice if it were that easy.
All it did was remove the first /
$name.URL = /assets/
$name.Filename = assets/
Sorry Steve, I should verify before posting. Try: $BackgroundImage.Name
Yes!!, you are the man!
PS. where do I find these table fields in the database?
formbgimagename = "form-bg-blue.png";
formbgimagesmall = "style="+"background-image:url(assets/Forms/Small/"+formbgimagename+")";
This doesn't work.