Wiccle.com in Facebook Wiccle.com in Twitter Wiccle.com in LinkedIn Wiccle.com in Youtube RSS from Wiccle.com Wiccle.com in Atom
 
 
 

Thread: Feature Request: export and import 'boxes' - just like 'layout'.

Started: March 7, 2010, 05:34 AM  ⋅  Zone: Public Forums  ⋅  Category: Install & Modification  ⋅  Posts: 3  ⋅  Views 633
Started by: john  ⋅  Description: With tutorial on how to create mirror units from a source unit. [Was: Another 'nice to have' feature.]
Post #1
Member: john  ⋅  Date: March 7, 2010, 05:34 AM  ⋅ Subject: "Feature Request: export and import 'boxes' - just like 'layout'."

Hi Markus,

My site is now live!!  Smile I tested the heck out of 1.21 and I really couldn't see any reason not to release it!

I'm planning to build a page (which will never be displayed to my members) where I can work on new content boxes before placing them in the live site.

Like the 'Layout' export & import feature (which saved me many hours of work), is it possible (sometime in the future) to develop a 'Box' import & export facility? Why? Because it would then be possible to update/upgrade/replace/add new boxes with little to no downtime on the site.

I admit I have no understanding of the complexities involved in doing this! It's a 'nice to have' - not a necessity.

 

UPDATE:

Having built a page template, see below:

I suspect that the test columns/rows/box sizes (% and pixel sizes defined in 'test') could play havoc with any pre-defined layout that a test box was imported into?

Never mind - can't have everything! Copy-and-paste is easy enough!

Post #2
Member: Markus  ⋅  Date: March 7, 2010, 02:57 PM  ⋅ Subject: "Re: Feature Request: export and import 'boxes' - just like 'layout'."

Grand! Congratulations for the occasion. Your site is looking great, and you have the additional honors of being the first iWiccle user who has put the system into heavy use — and apparently with grand success! 

If you want to make sure your footer content has the same margin above and below, remember that paragraphs get a 12px bottom margin (and 5px left margin) by default; you can eliminate that by adding in an inline style <p style="margin: 0px;"> to your footer HTML, or otherwise change the <p> tags to <div> tags, which get no default styles. (You can edit the paragraph default values in html.css, which contains all HTML tag definitions.)

 

Actually I have the unit import/export in my notes here already, it's coming in sooner or later, and will naturally be available for all units you have created to date. I really only need to do a slimming down of the layout import/export setup, in the range of 30 minutes of hack and slash. (But I have a gazillion features like that lined up! In case you were wondering why it isn't in already.)

In the meantime, don't copy and paste — include units within units. As follows (just look up the "mother" unit's ID in the builder unit dropdown):

<#UNIT_ID:1234#>

Create a custom unit and stick the above into the custom text field anywhere you want that unit to be mirrored. This will include your unit content inside another unit. Remember that the source unit is included with its base, so either 1) have your mirror unit without a base, or 2) have your source unit without a base in which case you can customize the box style individually for your mirrored units. This works both with static ("custom content") and with dynamic module content.

When you boot up the builder, you will also notice that you can click to edit both the mirrored unit "container" or the source unit, while only the mirrored unit is displayed in your Builder dropdowns. I recommend to edit the source unit at its original location, but it seems to be working fine both ways. Also, I have not tested this thoroughly in cross-module use, but again it seems to be working fine there too. My earlier warning on module configuration enveloping not being fully tested in cross-module contexts applies here as well.

(So many possibilities... I can't possibly test all those options exhaustively and in different contexts, because the possible combinations and usages are literally infinite! I just do basic testing on features like this and have faith in the framework symmetry until someone manages to break something. And if/when that happens, we simply adjust the CMS core accordingly to handle the situation more gracefully.)

The widths are only tagged for columns, so your source unit can appear in different widths in different contexts without a problem, as long as it looks decent to you.

Another tip for unit creation without showing half-done content to your members is simply tagging the unit's permission level for Root Administrators only. It will then be invisible for others, and you can tinker away all you want, or leave half-finished units in place without worrying about it.

Give it a shot and remember check in and let me know if you succeed in breaking something with this! =)

I have tagged this as an accepted feature request as a matter of formality. Cool

Post #3
Member: Markus  ⋅  Date: March 7, 2010, 04:18 PM  ⋅ Subject: "Re: Feature Request: export and import 'boxes' - just like 'layout'."

In the event that you're interested in how the layout import/export system works, you can look it up in class_builder.php. 

import_layout() at lines #517-637 imports the layout files you upload. export_layout() at lines #688-736 and build_export_data() at #138 -192 do the export crunching. The build export data function also handles the Admin CP MySQL database backups, so it's a generic SQL exporter. The export_layout() function just tells it to export tables "layouts", "columns", and "units".

In that file, you will also find import and export for layout sets (which is available in Admin CP > Site > Layouts for per-module layout backup and restore); they simply reuse the above functions in loops. The entire process fits in some 300 odd lines of code, and parts of it are also deployed in other contexts.

So adding in the unit export feature is a fairly uncomplicated operation — no rocket science involved! We try to keep things simple, short and orderly as far as possible.

 

Install & Modification

Add to Favorites
Public Forums
Category  ⋅  Deploying iWiccle and Wiccle into unique solutions that match your needs.
 

Public Forums

Add to Favorites
Public Forums
Zone  ⋅ Public forum sections for support and discussions. Available for everyone.
 

Zone Categories

 
Questions? Ask us!
Back to Top