FORUM IS CLOSED. PLEASE USE QUESTIONS / ANSWERS PAGE INSTEAD
Login  |  Forum  |  Search   

Board index » Development » Feature requests




Post new topic Reply to topic  [ 7 posts ] 
 
Author Message
 Post subject: Global widgets
 Post Posted: Thu Feb 02, 2012 12:06 pm 
Offline

Joined: Mon Jan 30, 2012 1:16 pm
Posts: 15
Would it be very difficult to add global widgets to IP?

By global I mean that you could drag a widget to a zone, then set a checkbox "Global" or something similar and from then on the widget would be displayed on all pages in selected zone.

This could be very useful for creating a user editable global sidebar or a user editable dynamic header for the site.

Best regards,
Roman


Top 
 Profile  
 
 Post subject: Re: Global widgets
 Post Posted: Fri Feb 03, 2012 12:21 am 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
There has been many talks about that. Technically it could be done. But the administration becomes so complicated... Everything is easy until one block starts to have global and non global widgets. I don't know how deep you are in that, but a lot of magic happens in that situation.

But there is one solution :D I haven't done that yet, but it should be easy. You can create separate page (hide it if you like or in separate zone). You can add widgets to that page sidebar. And then in layout file you can include exactly that sidebar from specifically that page.

The difference between global widgets as you have described would be just that you can't edit them inline. You need to go to that "special_hidden_page" to edit sidebar on all website.

If it is the way to go for you, I will find code lines that gets any block of widgets from any page.


Top 
 Profile  
 
 Post subject: Re: Global widgets
 Post Posted: Fri Feb 03, 2012 7:16 am 
Offline

Joined: Mon Jan 30, 2012 1:16 pm
Posts: 15
Thank you for your prompt reply :)

I have been a little experimenting yesterday with this idea and it's true what you pointed out - modifying everything was pretty easy until trying to mix global and non-global widgets in one block.

The hidden page idea would work albeit I think it's still a little cumbersome for end-user, but it got me thinking: how about simplifying the concept and being able to just define a global block - where every widget added to the global block would be treated as global?

Regards,
Roman


Top 
 Profile  
 
 Post subject: Re: Global widgets
 Post Posted: Fri Feb 03, 2012 8:31 pm 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
I'm thinking about this compromise. Glad to hear that you like it. Unfortunately it hasn't been implemented yet.

In case you would like to implement it as I've mentioned before, here is code you should use instead of "echo $site->generateBlock('side'); ". Keep notice, that static bar will be visible only in public website. In administration panel it will be not displayed at all.

Code:

                <?php
                    $staticZoneName = 'hidden';
                    if ($site->getCurrentZone()->getName() == $staticZoneName || !$site->managementState()) {
                        //print block without administration tools
                        $hiddenZoneElements = $site->getZone($staticZoneName)->getElements();
                        $firstElement = reset($hiddenZoneElements);
                        if ($firstElement) {
                            $publishedRevision = \Ip\Revision::getPublishedRevision('hidden', $firstElement->getId());
                            echo \Modules\standard\content_management\Model::generateBlock('side', $publishedRevision['revisionId'], $site->managementState());
                        }
                    }
                ?>


Top 
 Profile  
 
 Post subject: Re: Global widgets
 Post Posted: Mon Feb 06, 2012 10:33 am 
Offline

Joined: Mon Jan 30, 2012 1:16 pm
Posts: 15
Thanks for the tip it will sure come handy!

I have another semi-related question though: how would one go about creating a static sidebar from zone? For example, following this tutorial http://www.impresspages.org/docs/workin ... e-example/, but instead of having a just a link to the zone in the sidebar, I would like to have a list of people from addressbook.

The following doesn't work (probably I'm just missing something):
Code:
<?php echo $site->generateBlock('custom_zone'); ?>


Top 
 Profile  
 
 Post subject: Re: Global widgets
 Post Posted: Mon Feb 06, 2012 9:58 pm 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
I have prepared a topic to cover your question:

http://www.impresspages.org/docs2/core2/blocks/

Zones has nothing to do with generateBlock. I haven't understand what you want to achieve. So if there are some questions left, don't hesitate to ask.


Top 
 Profile  
 
 Post subject: Re: Global widgets
 Post Posted: Wed Feb 22, 2012 12:26 pm 
Offline

Joined: Mon Jan 30, 2012 1:16 pm
Posts: 15
Thank you for the answer, it is exactly what I needed - and yes, my mind somehow fused zones and blocks after an all-night coding session, so I apologize for incoherence :)


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 7 posts ] 

Board index » Development » Feature requests


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: