Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
@KK,

I have many places where I need to fetch only securefile editable from a page with many other editables. Optimizing my current setup, I feel like using skip_custom_fields parameter for cms:pages, to save some seconds of page load and keep ability of using securefile.

I see that it's complicated to make an exception for cms:pages in Couch code, because securefile is a custom field. But I can't evaluate complexity of adding masterpage and page parameters to show_securefile tag.

Since there are no such parameters now, I would use php code to complete my task. I have managed to get encoded value of securefile field directly with cms:get_custom_field. It gives me a string like this:
a:4:{s:7:"file_id";s:4:"MTcy";s:9:"file_name";s:12:"bG9nby5wbmc=";s:8:"file_ext";s:4:"cG5n";s:9:"file_size";s:8:"NTMyNw==";}


So, above string includes base64-encoded values. Could you help with some piece of php code to correctly decode this into readable state? I would use my existing solution to get the filename as in here viewtopic.php?f=2&t=10417

Or, better, maybe there are some internal Couch-functions, that could be called somehow to decode the above and set in context regular variables of securefile?

It would really improve some heavy pages. I have used all other available tweaks and only this one is left.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Writing helps. If this request is demanding, I would create a new clonable template with each page having just one securefile editable. Then on target page I would still be able to have skip_custom_fields='1' and fetch securefile content with cms:related_pages.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Could you help with some piece of php code to correctly decode this into readable state?
Try the following -
Code: Select all
$data = $FUNCS->unserialize( $data );

Hope it helps.
@KK, thanks.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
4 posts Page 1 of 1