You are not logged in.
Hi,
I'd like to make a function that checks if there's a cropped image.
If not, use the uncropped image. If there's no uncropped image either, use a placeholder image.
I thought it was a good idea to put this inside custom/inc/require/utils. I place all small reusable custom functions in here.
But now I get a waring / error message "cannot send session cookie. headers already send etc. etc." and the whole site doesn't work.
I've had that problem with more cases. For example when doing a require to a vendor /composer folder that does an api call or db request.
So I was wondering: what's the proper place / way to place these kind of functions mentioned above in Bigtree?
I could just include everything in a layout, but probably there's a more elegant way that I don't know of.
Thanks in advance!
EDIT: any empty lines or things before opening php inside an inc/required file break the site or result into a warning.
Never had this issue before... So it might be a bug.
Last edited by Terrra-Robin (November 26, 2018 8:28am)
Offline
It's possible your environments before defaulted to having output buffering turned on. Since /custom/inc/required/ is included in bootstrap and output buffering isn't turned on until after bootstrap is executed, any errant new line output from a /custom/inc/required/ file will likely cause sessions to fail to start. Are you using the new database session handler? It's possible that handler is less tolerant and won't silently fail.
Offline
It's possible your environments before defaulted to having output buffering turned on. Since /custom/inc/required/ is included in bootstrap and output buffering isn't turned on until after bootstrap is executed, any errant new line output from a /custom/inc/required/ file will likely cause sessions to fail to start. Are you using the new database session handler? It's possible that handler is less tolerant and won't silently fail.
Thanks again Tim! I had an old environment file without the session_handler entry in it.
When I put "db" in it, it seems to work perfectly fine:)
Offline