News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Embedding dynamic content in News (sy-box)

Started by arminus, September 30, 2022, 01:40:18 PM

Previous topic - Next topic

arminus

I have a request to add some dynamic content (quote of the day, created by a custom php function) to the news / sy-box slider. As far as I can tell, it's only possible to add BBC or HTML there (I guess php being added here might be a security issue...)

Anyway, if not via news/sy-boy, is there any other way or mod to add this in approximately that position/layout without hacking into SMF sources?

Doug Heffernan

Quote from: arminus on September 30, 2022, 01:40:18 PMis there any other way or mod to add this in approximately that position/layout without hacking into SMF sources?

I have not seen such a mod myself. I 've moved this to the Mod Request section. Hopefully someone will code it for you.

@rjen

Well, there is a way: install a portal mod and use a php block in the upper section of the board index ...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

arminus

Quote from: @rjen on September 30, 2022, 01:57:13 PMWell, there is a way: install a portal mod and use a php block in the upper section of the board index ...
e.g. TinyPortal? judging from your sig ;-)

@rjen

... that's my Portal of choice, but there are more options...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

arminus

Well, thanks for the hint. Works like a charm :)

Doug Heffernan

Glad to see that Tiny Portal worked out for you. Marking this as solved.

dodos26

I think you can use mod to create bbc. Or create mod for bbc :P It's not complicated as we now have hooks.

Example code from SimplePortal - Blok php.
Instead of content, add the code from content bbc :P

$content = trim(un_htmlspecialchars($content));
if (substr($content, 0, 5) == '<?php')
$content = substr($content, 5);
if (substr($content, -2) == '
?>
')
$content = substr($content, 0, -2);

eval($content);


Also remember that eval will return an error because of the apostrophe found in the database :P Fix it :D
Found:
$content = trim(un_htmlspecialchars($content));
Replace:
$content = trim(htmlspecialchars_decode($content, ENT_QUOTES));

Advertisement: