Topics

User Functions

Events

There are no upcoming events

What's New

Stories

No new stories

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Wednesday, May 22 2013 @ 11:01 AM EDT


 Forum Index > Extensions > PHP Blocks New Topic Post Reply
 Dynamic blocks
   
suprsidr
 07/13/12 12:39PM (Read 1011 times)  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
So today I had a chance to play around w/ dynamic blocks for 2.0b1

I've got to say, and I'm sorry, but what a horrible, horrible implementation.

I know my way around geeklog and its APIs very well, and you've got me confused - this is just plain bad decision making.

Users wanted a way to better control blocks, not this.
  • a plugin author can create a dynamic block and force its use simply by not supplying config options for it.
  • no options to enable/disable dynamic blocks in the block editor. this is going to have new users plain confused.
  • if a plugin author does supply conf options for it, the options are not part of the block editor, but in a whole separate place and not all dynamic block configs are even grouped together.
  • these blocks are tied to topics? huh? so how do I decide what blocks show on my plugin pages? - oh right, back to configuration.
  • there is more


Here are my suggestions:
when a user creates a story, staticpage, poll or whatever, they choose from a list of available blocks(dynamic or regular) for the right and left or none at all.
Maybe make it a fun drag/drop, sortable widget - we have jQuery.
Save the story, staticpage, poll.. with the array of block ids(right and left) - Done!
This is the level of control users want from blocks.

-s

FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 
Profile Email Website
 Quote
Laugh
 07/14/12 09:52AM  
AAAAA
Admin

Status: offline


Registered: 09/27/05
Posts: 876
The Dynamic block API have been in place since Geeklog 1.4 I believe. No new API has been added it was just never used much until now when we moved over the core plugins to use them so they wouldn’t touch directly the block table.

I admit that the block interface is confusing with the Dynamic blocks and Regular blocks separate and not being able to edit Dynamic blocks directly. Dynamic blocks information is stored in the config so this was not going to be an easy task and would require additional API to work. Basically the whole interface would have to be rewritten. Which is fine and needed but we ran out of time. Hopefully these changes will make it into the next release.

The Topic Admin Editor also could use a rewrite with a nice drag/drop interface since we now have child topics but this was cut due to time constraints as well.

when a user creates a story, staticpage, poll or whatever, they choose from a list of available blocks(dynamic or regular) for the right and left or none at all.


This would be difficult to do at this point since blocks have always been tied to either the homepage, all pages or a specfic topic.

Tom

 
Profile Email Website
 Quote
suprsidr
 07/14/12 10:38AM  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
This is what I'm building into my new theme:
A new block editor that will allow a user to choose from all available blocks and drag/drop to left or right and drag/drop to sort.
Each block's title will also be editable as sometimes I like to have a different title in different contexts - or none at all.

So a new table will be created to hold:
'type'=>'story', 'staticpage' or 'poll',
'id'=>story, staticpage or poll id,
'lblocks=>array(array('bid'=>block's id, 'title'=>regular block title or chosen new title)),
'rblocks=>array(array('bid'=>block's id, 'title'=>regular block title or chosen new title))

and in theme_createHTMLDocument I'll load my blocks based on this new info.

So far I have chosen HTML5 Sortable and have wireframed my block editor which will be integrated into story, staticpage and poll editors.(any others I should consider?)

Not really sure if it will be appropriate for polls as I've never really used them.

On another note, and this is very important:
Before release, you should require plugins to supply plugin_getBlocksConfig_pluginName and some actual config options before allowing the plugin to return plugin_getBlocks_pluginName

Just for a test I created:
PHP Formatted Code

function plugin_getBlocks_G2Bridge($side, $topic='') {
    if ($side=='right')
    return array(
        array(
            'name'           => 'G2B_rand_photo',
            'type'           => 'dynamic',
            'onleft'         => false,
            'title'          => 'Random Photo',
            'blockorder'     => 1,
            'content'        => phpblock_G2B_rand_photo(),
            'allow_autotags' => false,
            'help'           => ''
        )
    );
}
 

and my Random Photo block shows up like it is supposed to, but without any config options or even plugin_getBlocksConfig_G2Bridge
the site owner is going to be confused/frustrated as to where this block is coming from and have no way to disable
without editing code or disabling the plugin.

-s

FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 
Profile Email Website
 Quote
suprsidr
 07/14/12 10:58AM  
+++++
Full Member

Status: offline


Registered: 12/29/04
Posts: 552
Also maybe in the topic editor you can choose default blocks for that topic.
And in admin/block.php instead of choosing topics have same drag/drop interface for some default views like homeonly, admin and profiles

-s

FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 
Profile Email Website
 Quote
Laugh
 07/15/12 09:43AM  
AAAAA
Admin

Status: offline


Registered: 09/27/05
Posts: 876
Before release, you should require plugins to supply plugin_getBlocksConfig_pluginName and some actual config options before allowing the plugin to return plugin_getBlocks_pluginName


Good idea, I added a feature request for this.

So far I have chosen HTML5 Sortable and have wireframed my block editor which will be integrated into story, staticpage and poll editors.(any others I should consider?)


I would try to make it accessible to any plugin if possible through an api. When you have a beta going send me a link.

A new block editor that will allow a user to choose from all available blocks and drag/drop to left or right and drag/drop to sort.


While you can't do this for individual objects in Geeklog you can now build into your plugin the ability to assign a topic to an object. This way the object (ie staticpage) will take on the topic characteristics (like blocks). Plugins use to only be able to display all blocks. With the way topics can be hidden or not and the ability to inherit blocks from child topics Admins have many more options than before.

Tom

 
Profile Email Website
 Quote
Content generated in: 0.43 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content