Serialize

Cupara

Well-known member
Can anyone shed some light on how serialize works within XenForo? I ask because I adopted Jaxel's layout portion of XenPorta but for the life of me, it saves all positions of blocks as 'disabled'. When it inserts the data it serializes all data then unserializes when pulling it to display on the front page.

If anyone needs to see files then I will gladly share files.
 
Thanks Jake, tried it but for what I'm doing it won't work.

I'm trying to understand why it won't save 'position' for each block where I have them.

Here is the layout page:
layout.webp

Output when unserializing on front page:
array(8) {
["LatestArticles"] => array(5) {
["block_id"] => string(14) "LatestArticles"
["title"] => string(15) "Latest Articles"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["LatestPosts"] => array(5) {
["block_id"] => string(11) "LatestPosts"
["title"] => string(12) "Latest Posts"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["LatestThreads"] => array(5) {
["block_id"] => string(13) "LatestThreads"
["title"] => string(14) "Latest Threads"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["Navigation"] => array(5) {
["block_id"] => string(10) "Navigation"
["title"] => string(10) "Navigation"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["News"] => array(5) {
["block_id"] => string(4) "News"
["title"] => string(4) "News"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["NewsArchive"] => array(5) {
["block_id"] => string(11) "NewsArchive"
["title"] => string(12) "News Archive"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["PopularThreads"] => array(5) {
["block_id"] => string(14) "PopularThreads"
["title"] => string(15) "Popular Threads"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
["Welcome"] => array(5) {
["block_id"] => string(7) "Welcome"
["title"] => string(7) "Welcome"
["display"] => string(4) "show"
["block_active"] => int(1)
["position"] => string(8) "disabled"
}
}

Each one should save as the location in the screenshot such as top-left, mid-right, sidebar, etc.
 
Are you using JqueryUI to make movable box into a list using "sortable"? If yes, there is a serialize function.
You can write a javascript to insert the last configuration into an hidden field of your form. Then when you press on "save", you can do an action to get those datas from the empty field. After this, you can play with those datas as you want to. That what I did with the Mark It Up integrator. If you want my addon (as I proposed you in pm ^^) to see the code and use it, don't hesitate.
 
I ended up reverting everything. I had the jQuery and all in place, it just wouldn't save for nothing the position. The template had a hidden field and all.
 
Top Bottom