Blending box with block and php problem, what am I missing?
|
Posted
#77673
(In Topic #15972)
|
|
|---|---|
|
Fan in action |
My sidebar code looks like this: Code
[block day="monday" id="8947774"]on_day_do_ustream[/block]
And my miniblock looks like this: Code
<?php
When I add the "box=test" to the code, inside the echo statements, to surround the iframe with a box, and save it all, it actually prints literally the "box" code, and does not create a box around my iframe code. I have tried adding some semihtml statements in various places, but that also just prints literally, followed by a correctly displayed iframe of the UStream window. Any ideas how to make my code integrate the box as well as the iframe? |
|
Posted
|
|
|
ocStaff (admin) |
Code
$e=ob_get_contents();
If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
|
Posted
|
|
|
Fan in action |
I don't see where ob_get_contents gets stuff from, because it takes no arguments. I'm assuming it's getting some sort of global structure and ob_clean must clean the code for echoing. As an amateur programmer, although this works perfectly, I don't know what it actually does, what it "gets" and what it "cleans." Regardless, I'm happy with the results. I added some arguments to put_in_standard_box so that it would print the title of the box and the type. For others new to OCPortal code, the finished code I used to use a miniblock that prints a box that surrounds an iframe that takes arguments looks like this: Code
<?php
and the sidebar code looks like this: Code
[block day="monday" title="SomeBoxTitle" id="1234567"]on_day_do_ustream[/block]
Now, I'm about to wrap this up and be happy with it, but for one minor detail. When I "edit" the sidebar/sidepanel content, it allows me to "click to edit" a block. Most blocks have arguments, and when you "click to edit" a block, you can edit those arguments by "clicking to edit." However, although my little custom miniblock has 3 arguments, they do not show up as such when I "click to edit" the miniblock. In fact it says something like 'this miniblock has no arguments.' How can I tell the editor that my miniblock has editable arguments, so that I don't have to edit the source code each time? |
|
Posted
|
|
|
ocStaff (admin) |
Thanks for writing this up, great to see more coding discussion going on around here The put_in_standard_box function is frowned upon because it's hard-encoding an assumption via PHP code. That is the assumption that something will be in an ocPortal standard box. In your case, your the master of what you're doing, it matters not to you. It's more of a software design issue for us – we tend to encode use of boxes within templates, so that users may easily change that. ob_* refers to PHP's output buffering. Miniblocks work by turning on output buffering in the ocPortal code, running the miniblock, and then collecting that buffer. That's why you can just echo stuff out into a miniblock. It's not in actuality being echoed into the output stream, it's being buffered and collected by ocPortal. However in this case, as you need to feed your output through a function, we make use of the buffering already active to collect the buffer contents, empty it, then pipe it through the box function. Regarding block parameter UIs, that is where you'd need to create a normal block rather than a miniblock. Lots of our addons do this and can serve as examples (e.g. the ebay addon) - get that, then examine the files inside the tar in a text editor. The normal blocks are PHP classes that define lots of extra stuff that define the behaviour of the block somewhat. Also there are associated language strings for putting out the descriptions for the defined parameters. If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource. |
1 guests and 0 members have just viewed this: None
Control functions:







