gorokizu
gorokizu

Reputation: 2588

Inserting a php variable in background-image

I'm trying to build a widget for a website that displays a random background image everytime the page is refreshed and i'm running into some trouble with string concatenation.

$display .= "<p class=\"ey-image-quote\" style\"background-image:url('".$img."')\">" . $this->quote . "</p>";

This returns a url without slashes (replaced by spaces) and i have not found a viable solution yet. Is there any way to achieve this in php?

Upvotes: 0

Views: 146

Answers (1)

pr1nc3
pr1nc3

Reputation: 8348

$display .= "<p class=\"ey-image-quote\" style=\"background-image:url('".$img."')\">" . $this->quote . "</p>";

You forgot = in style

Upvotes: 3

Related Questions