echo/return in the core

Discussion corner for Developers of Serendipity.
Post Reply
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

echo/return in the core

Post by onli »

Because of the smartification, it turned out that a lot of functions in the core had to be catched with ob_start and then the buffer filled into smarty-variables to position the sections in the desired flow. So I already started to change some functions to use return instead of echo.

I realize that this might be problematic, because there was a pattern before: Functions called print_X echoed their content. Now that is mixed up.

I want to change that by letting all functions return their content, always. Only the very first level, index.php/genpage.inc.php and serendipity_admin.php, should echo stuff.

Does that plan has flaws? Or do all agree?


PS: I feel like I already wrote that in this forum, but I can't find it. Maybe I just wanted to do that.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: echo/return in the core

Post by garvinhicking »

Hi!

Sounds doable, and is definitely better in terms of API design. This is an API BC break, so we should create a list of all functions that no longer echo stuff, so that plugin developers can adapt their code by searching if they use that function/method.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: echo/return in the core

Post by onli »

Agreed, I already startet that documentation in https://github.com/s9y/Serendipity/blob ... 0-temp#L19.
Post Reply