Php Problem On SPPB4 Override Article Addon - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

Php Problem On SPPB4 Override Article Addon

F

Fabrice

SP Page Builder 2 years ago

Hi, I'm on SPPB4, template Maestro. I created an overide for sppsagebuilder/addons/articles/site.php I have to use the image into a $output .='<div style="background-image: url("./'.$mythumbnail.'");">ABWW</div>';
My url is l'url /demo3/images/2022/12/30/XXX.jpg When I get on the site page, the code turns into "<div style="background-image: url(" .="" demo3="" images="" 2022="" 12="" 30="" XXX.jpg");"=""> What can I do ?

ps ; I was simply hoping $output .='<div style="background-image: url("' . ($default_placeholder && $page_view_name != 'form' ? $default_placeholder : $image) . '");">ABWW</div>'; could possibly do it but it didn't.

0
10 Answers
F
Fabrice
Accepted Answer
2 years ago #101707

Wow, my apologies on this one... After reviewing this thing fo the millionth time, I realized I misspelled and forgot a couple of ' ' ... $myDiv='<div align=center id="background" style="background-image: url(\''.$mythumbnail.'\');">DDD</div>'; In case that can help anyone in the future...

0
F
Fabrice
Accepted Answer
2 years ago #101086

... seems that your system reformulates the variables... If I feed it with $mythumbnail="AAAA"; uppercase it sends me back "aaaa"... lowercase So Is there a piece of code to tell it to leave that thing alone?

0
F
Fabrice
Accepted Answer
2 years ago #101376

Anyone at all ??? Maybe my description is not clear. Please let me know if you don't understand my concern.

0
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 2 years ago #101551

Hello Fabrice

Please share a screenshot of your issue to understand it better. Take a screenshot and share via any platform. For example: Lightshot or Imgur. Also, share the page link so that I can check the issue.

Best regards

0
F
Fabrice
Accepted Answer
2 years ago #101611

ok, let me resume : I overrode the sppsagebuilder/addons/articles/site.php so I can have a <div> with a css background-image so I can control the size of the image no matter what image size the final admin is going to feed in. So line 267 -> 270. The public page gives me the correct info aka "./demo3/images/2022/12/30/glisse_academy.jpg" on page header with my echo. When I feed the same variable in my css background-image, the public page gives a url that is completely off and seems to treat the info as an array.

https://imgur.com/a/uZIubuz

I'm wasting an insame amount of time on such a strange behaviour. Why can't I just use the '($default_placeholder && $page_view_name != 'form' ? $default_placeholder : $image)' such as line 272 which is sending me the same array result.

0
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 2 years ago #101705

Sorry, we do not provide customization support. I think you need to consult a developer for this. It is your code and your responsibility.

0
F
Fabrice
Accepted Answer
2 years ago #101710
0
Pavel
Pavel
Accepted Answer
2 years ago #101719

Hi Fabrice.

I overrode the sppsagebuilder/addons/articles/site.php so I can have a <div> with a css background-image so I can control the size of the image no matter what image size the final admin is going to feed in.

Just to let you know. For these purposes, you can use CSS only object-fit: cover; for example. Not need php override

0
F
Fabrice
Accepted Answer
2 years ago #101726

Hi, my apologies on this one, the whole issue was a misspelling... In the end , works better with the background-image: url(\'...\')... $output .='<div align=center style="background-image: url(\''.$item->image_thumbnail.'\'); height:250px; background-size: cover; background-position: center;"></div>'; Sorry guys, thanks for your patience.

0
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 2 years ago #101730

You are welcome 😊

Please accept the answer that helped you. It will be then easier to find the solution for the other users with the same issue. There is a button to accept answer after each comment.

0