Development
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
June 2005
- 69 participants
- 404 discussions
Issue status update for http://drupal.org/node/11077
Project: Drupal
Version: cvs
Component: base system
Category: tasks
Priority: normal
Assigned to: crunchywelch
Reported by: killes(a)www.drop.org
Updated by: mfb
Status: patch
Great! event_timezones.inc definitely needs to be in core, as it would
be used for both user and site configuration. But it should include
everything from the unix zoneinfo libraries, e.g. timezone
abbreviations used by strftime(), so you can display "PDT" or "PST"
instead of "America/Los_Angeles".
so, a complete port of the zoneinfo libraries to PHP is probably what
is needed. This would be used for site config, user config and events.
mfb
Previous comments:
------------------------------------------------------------------------
September 25, 2004 - 20:01 : killes(a)www.drop.org
Attachment: http://drupal.org/files/issues/dst.patch (6.04 KB)
Many people have wanted to have a Daylight Saving Time setting in the
past. If we use the "server time" modell (all times are displayed the
same around the world) this isn't all that hard to do.
I found a lot of usefull information here:
http://webexhibits.org/daylightsaving/g.html
The patch introduces a new DST setting and uses it if the "Configurable
time zones" setting is switched off.
------------------------------------------------------------------------
September 25, 2004 - 21:40 : gordon
This is a lovely patch, but you do realise that you have opened a can of
worms.
Daylight saving is a messy business, I had to write the Contestable
Electricity billing for a company here in Australia which had multiple
installations in multpile timezones, all with different daylight
savings rules, which impacted upon the bill. The way that dst is
legistated is very messy and here is Australia it is very messy.
Daylight savings don't follow state lines, as some towns that are very
close to the border may choose to follow the only the daylight saving
period of the next state, and when we had the olympics NSW went into
daylight savings months before anyone else. There are other examples of
weird things like even the 1 hour forward is not also true. I know that
in the 1999 change to daylight savings there was a small set of islands
north of New Zealand that went ahead by 2 hours as they wanted to be the
first into 2000.
>From what I can see of your patch it only allows for a single daylight
savings period for the entire system. Their can be situations where
there can be users from multiple countries and in different
timezones/dst.
I think that entire timezone system needs to looked at again, and maybe
re-implement it so that it will allow for dst. Maybe make it a bit more
user friendly so instead of setting up the timezone by name much like
how operating systems do it, and then this will automatically work out
the timezone.
+1 for this is something that would be good, but it still needs work.
------------------------------------------------------------------------
September 26, 2004 - 07:13 : Anonymous
The patch works as it is now. I had good reason to limit its capability
to the setting where users cannot chose their own timezone. ;)
I also assume that a server administrator knows if he has dst or not. I
also didn't (yet) cater for all countries where dst is in use mainly
because some insist on not giving a sensible rule for the change dates.
------------------------------------------------------------------------
September 26, 2004 - 15:54 : killes(a)www.drop.org
Attachment: http://drupal.org/files/issues/dst_0.patch (6.04 KB)
The last comment was mine.
After a code review by Kjartan I provide a slightly improved patch.
I want to stress that solving the DST issue in a "suits everybody"
manner isn't the intention of this patch.
It solves the problem for people who have chosen to let all times on
their site be displayed in the server's time setting. By covering a
large portion of the earth's landmass I hope to be able to help most
site admins.
It would be possible to extend the patch to allow users to chose their
DST setting, too. In my experience, however, users tend to not care
about time settings at all. This may be EUrocentric though, as we have
only one time zone. Feedback is welcome.
------------------------------------------------------------------------
September 27, 2004 - 14:12 : drumm
+1
>From a code review I think this is an excellent solution. Could use a
little more comments in the section that sets $node->date to explain
the (probably good) reasoning behind that chunk of code. I don't have
anything resembling a good set of tests so I did not apply the patch
and try it.
------------------------------------------------------------------------
January 25, 2005 - 13:38 : killes(a)www.drop.org
I just want to point out that this patch still applies and would make
for a fine feature for Drupal 4.6...
------------------------------------------------------------------------
January 26, 2005 - 09:46 : alliax
wouldn't hurt to have this feature in upcoming drupal.
I would use it for sure, my users are from the same place, with dst
------------------------------------------------------------------------
April 28, 2005 - 09:12 : Sage
This is an incredibly useful feature and I would like to see it
incorporated into the next release (current release is 4.6.0).
------------------------------------------------------------------------
May 4, 2005 - 09:06 : syntaxerror
Works beautifully.. I'm going to work on getting this to work with
event.module.
------------------------------------------------------------------------
May 4, 2005 - 10:53 : crunchywelch
I have just discussed with killes and rorris an enhancement to this
patch which I will implement. We have proposed putting the ical
timezone db
(http://cvs.drupal.org/viewcvs/drupal/contributions/modules/ical/ical.sql?re…)
in core. We will implement a DST field in that db for each zone which
coreesponds with the zones in killes' patch here for dtermining whether
a zone is currently in dst or not. Currently, the 5 zones in the
drupal_is_dst() function in this patch will be the only regions
assigned to timezones. If more regions are desired they can be
submitted by the community.
To be clear, this must be implemented before additional development on
ical/event.module can proceed properly. We would like this to be in
core for 4.7, and move one more step with timezone handling in event
module to use this as well.
Discuss!
------------------------------------------------------------------------
May 4, 2005 - 11:13 : tostinni
I agree to put more specific region to DST as it's easier for someone to
know which city DST he belongs than which DST Zone (Pacific Standard
Time...).
I like pretty much the way that windows manage this.
+1
------------------------------------------------------------------------
May 4, 2005 - 19:45 : Jaza
The patch looks good... however, it doesn't take into account the fact
that in Australia, DST starts and ends at 2am on Sunday morning. So
these lines:
case 4: // Australia
// start of DST (last Sunday in October)
$dststart = strtotime("-1 week sunday GMT", strtotime("1
november $year GMT")) + $timezone;
// end of DST (last Sunday in March)
$dstend = strtotime("-1 week sunday GMT", strtotime("1
april $year GMT")) + $timezone;
break;
Should read:
case 4: // Australia
// start of DST (last Sunday in October at 2am)
$dststart = strtotime("-1 week sunday GMT", strtotime("1
november $year GMT")) + 7200 + $timezone;
// end of DST (last Sunday in March at 2am)
$dstend = strtotime("-1 week sunday GMT", strtotime("1
april $year GMT")) + 7200 + $timezone;
break;
There are also a whole lot more countries (and their specific DST
rules) on http://webexhibits.org/daylightsaving/g.html than are
implemented in this patch. I'd ultimately like to see an admin
interface to let the webmaster add additional DST rules for whatever
country they live in (or are developing for). These rules could be
entered in raw PHP, or using a somewhat friendlier interface.
Jaza.
------------------------------------------------------------------------
May 24, 2005 - 23:11 : Steven
+1 on this patch. Catches most cases and at least provides a base for
others to work on.
------------------------------------------------------------------------
May 25, 2005 - 00:13 : gordon
Do not take this the wrong what, but when it comes to dst, this is
exemely simplisict.
What would be the best method of doing this is to use the Zone Info
files from libc. These not only have all the dst splits, but also all
the timezones, and would be the most acurate.
Have a look at Sources of Time Zone and Daylight Savings Data [1] whcih
has pointers to where all this information is.
Did you know that Australia has 21 different Timezones and DST areas.
If you could enter the same information from tzdata then this would be
the altermate dst system
[1] http://www.twinsun.com/tz/tz-link.htm
------------------------------------------------------------------------
May 25, 2005 - 05:25 : jhriggs
There has sure been a lot of talk about DST and time zones lately. All
I ask is that we hold off on committing anything for a bit. I am
currently working on a project that will hopefully fix this issue
completely, correctly, and once and for all. :-)
I am in the process of writing a pure PHP library that will be released
LGPL that uses the /real/ zoneinfo data files to handle any date (not
just Unix timestamps) in any time zone. With this, site admins and/or
users will be able to select their real time zone (America/New_York vs.
our current GMT -500) and DST will inherently be handled without users
having to change their settings. Much of the grunt work is already
done. I still have to put all of the pieces together and make sure
everything is well documented. As soon as I have tested everything to
my satisfaction, I will role a Drupal patch that we can hopefully get
tested and committed ASAP. Of course I want to see this get into
Drupal first! ;-)
I hope to have everything completed in the next couple of weeks, but
based on the way things have been going lately, I can't make any
promises. It will definitely be done before 4.7, though...whatever it
takes!
------------------------------------------------------------------------
May 25, 2005 - 05:47 : gordon
+1
This sounds great, but I think we will still need a pure php version
that will be able to be used on hosted web sites where we will not be
able to get you library installed. It doesn't need to be as effient as
the php extension, as sites that at that big will be self hosted and be
able to install this library.
One question. Does you extension run on windows. If it does this is
another reason to have a pure php version.
This is really the method that should be employed.
------------------------------------------------------------------------
May 25, 2005 - 05:53 : jhriggs
When I say "library," I just mean a collection of PHP files as opposed
to a single file. There is nothing to be installed like an extension.
This is pure PHP that will simply be part of the distribution (a handful
of .php files placed inside includes/zoneinfo or something like that).
As this is pure PHP, it will work anywhere PHP does. This will
essentially give us the benefit and functionality of using the TZ
variable on Unix without all of the problems associated with that (i.e.
not knowing what zones are available and what there names are, not being
available on Windows, etc.).
------------------------------------------------------------------------
May 25, 2005 - 06:27 : gordon
This sounds good. If you would like someone who has done alot of stuff
with timezones and dst (mainly in the contestable electricity inductry
in australia, which is required for billing), I would be quite happy to
take a look.
The only problem that I see is that it sounds a little too messy for
core. maybe this could be made into a contributed module that can be
installed if people need the correct timezones.
However this is how the dst and timezones need to be done if we want to
get them correct. As I said before and I couldn't believe it, Australia
has 21 different timezones and dst areas. The timezone database needs
to be maintained.
------------------------------------------------------------------------
May 25, 2005 - 07:41 : killes(a)www.drop.org
jhriggs, gordon: Please have a look at crunchywelch's dst implementation
for event.module (in 4.6 and cvs). We intend to push this into core.
1
0
iTunes 4.9 (released earlier today) has Podcast support. I upgraded
and it works like a charm. Apple defined their own iTunes namespace
(RSS extension) though:
http://phobos.apple.com/static/podcast_specifications.pdf
--
Dries Buytaert :: http://www.buytaert.net/
3
2
hook_form(&$node, &$param)
&$node The node being added or edited.
&$param The hook can set this variable to an associative array of attributes
to add to the enclosing \<form\> tag.
Return value
A string containing HTML defining form elements to be displayed in the node
edit form.
This is called from:
// Get the node-specific bits.
// We can't use node_invoke() because $param must be passed by reference.
$function = node_get_module_name($edit) .'_form';
$param = array();
if (function_exists($function)) {
$form .= $function($edit, $param);
}
My question is: why $node is a reference form hook_form? To edit the node we
have hook_load and hook_validate. I propose changing the documentation.
Still a module author can write &$node and edit $node in his _form but at
least do not document it so.
Regards
NK
1
0
Issue status update for http://drupal.org/node/18616
Project: Drupal
Version: 4.6.1
Component: database system
Category: bug reports
Priority: normal
Assigned to: Anonymous
Reported by: plj
Updated by: plj
-Status: active
+Status: patch
Attachment: http://drupal.org/files/issues/database_1.patch (660 bytes)
On a second thought, here is a patch against both DBs. Both are
untested, but the change is tiny.
plj
Previous comments:
------------------------------------------------------------------------
March 9, 2005 - 13:38 : plj
The Postgresql database script shipped with Drupal 4.5.2 has a 32
characters long varchar value for role name. The relevant UI form
field, however, has attribute maxlength="64". This naturally causes an
SQL error, if too long name is entered.
The SQL part is still same in CVS version, but I don't know if the UI
part has been fixed.
Related SQL:
CREATE TABLE role (
rid SERIAL,
name varchar(32) NOT NULL default '',
PRIMARY KEY (rid),
UNIQUE (name)
);
------------------------------------------------------------------------
June 28, 2005 - 16:51 : plj
Changing version to 4.6.1, and component to database system (perhaps
more relevant than user system), as the problem still exists. It also
seems that the length of the field in question is only 32 in both
database.mysql and database.pgsql, even though the UI allows 64.
Either UI or the database scripts should be fixed.
1
0
[drupal-devel] [feature] Enable multiple block regions (not just "left" and "right" sidebars)
by nedjo 28 Jun '05
by nedjo 28 Jun '05
28 Jun '05
Issue status update for http://drupal.org/node/16216
Project: Drupal
Version: cvs
Component: block.module
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: paragkenia
Updated by: nedjo
Status: patch
Attachment: http://drupal.org/files/issues/showregions.module.txt (1.13 KB)
Here's a sample module using the patch's regioning. When installed, it
visually marks all available regions when you visit the page
?q=showregions. This is implemented using the proposed
system_region_list() and drupal_set_content() functions. (I've
attached a .txt extension to the module file since otherwise module
files seem to get rewritten when uploaded.)
nedjo
Previous comments:
------------------------------------------------------------------------
January 26, 2005 - 06:27 : paragkenia
I read the comparision discussion between *Drupal* and *Mambo*. In
several messages it was outlined that Drupal can place blocks only in
right and left and not flexible to put them on anywhere where one want.
It will be great if this can be changed in upcoming versions.
I am no pro at PHP, so don't know how much time this task will take,
but I think it is very important.
parag
------------------------------------------------------------------------
April 14, 2005 - 21:44 : nedjo
This issue was apparently partially addressed in issue
http://drupal.org/node/19694 [1].
[1] http://drupal.org/node/19694
------------------------------------------------------------------------
April 16, 2005 - 20:24 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions.patch (8.17 KB)
This much-requested functionality - to have the ability to place blocks
in more than the two predefined regions - was partially addressed in
issue http://drupal.org/node/19694. [2]. But "blocks" are still
limited to the "left" and "right" sidebars (hard-coded in
block.module).
This patch is a first step designed to enable multiple (eventually,
admin-definable) regions for blocks. I've moved the existing "left"
and "right" block regions to a 'region' table (with ids of 0 and 1, as
currently used in themes). Then all references to the regions are
drawn dynamically from the table. This way, if further records are
added, they will appear in the list of available regions for block
placement.
Doing this actually reduces some duplicated code, since it's no longer
necessary to repeat code blocks for each of "left" and "right".
As it stands, the patch doesn't add any new functionality--but I don't
think it breaks anything either. New functionality would need (a) new
regions defined, and (b) changes to themes. A simple first step might
be, e.g., to add a "footer" region and then add a call in the footer
generation to append any blocks assigned to the footer region there.
I'm setting this to patch, but I'm aware that it needs some discussion
and refining before it'll be ready to apply.
[2] http://drupal.org/node/19694.
------------------------------------------------------------------------
April 16, 2005 - 21:05 : nedjo
Attachment: http://drupal.org/files/issues/block_regions.png (5.65 KB)
Here's a screenshot showing the block admin page, with drop-downs for
region placement (the options are dynamically generated based on
defined regions).
------------------------------------------------------------------------
April 16, 2005 - 22:57 : adrian
The biggest problem with this is that you can have multiple themes, and
each of these themes can have different regions available.
Also, the method of defining which regions are available needs to be
standardised. Some of the work that me and Vlado are working on for the
install system would go towards solving that problem (ie: meta
information for modules, themes and styles).
This has been discussed to death, but the general consensus has been
that we _want_ to do this, but we need to solve a few other problems
properly first, the most pertinent being the interface issue. Chris
(factoryjoe) recently did a whole mess of workflows for something
related to this.
------------------------------------------------------------------------
April 17, 2005 - 00:09 : syscrusher
The first paragraph of adrian [3]'s post is a point that occurred to me
also, as I read this thread.
One suggestion would be to separate the definition and configuration of
blocks, on one hand, from the placement of those blocks, on the other
hand.
In other words, Drupal core provides a mechanism defining what blocks
exist, which of these are on by default or off by default and
user-selectable vs. which are forced on for all users, and the
configuration (if applicable) of specialized blocks defined by
particular modules.
Each theme provides a standard hook function that returns an array of
region names and help/description text, e.g., array('left'=>t('This
vertical region is left of the main content area'), 'right'=>t('This
vertical region is right of the main content area'), 'footer'=>t('The
footer is below the left, right, and main content areas of the page')).
The theme part of Drupal core (i.e., theme.module itself, not the
individual themes) provides a standard UI that is displayed within
config of *each theme* (but is one physical code base within
theme.module) that allows the administrator to map blocks defined by
Drupal core into regions defined by the theme, and storing that mapping
as an theme-to-block_ID-to-region_ID (with weight) table in the
database. From there, the actual page rendering is similar to what's
being done now, but there is more of it.
I guess what I'm trying to say is that the key to solving this problem
is breaking it along its degrees of orthogonality, and there are three
-- two in Drupal core and one in the individual theme.
Scott
[3] http://drupal.org//user/1517
------------------------------------------------------------------------
April 17, 2005 - 03:14 : Dries
Scott, is right. The theme should export its available regions. Then
the administrator's task is to assign blocks to regions (not to setup
regions). A theme could have configurable regions, but that internal
to the theme.
To me, the real challenge is the UI and the interaction design.
Configuring blocks could easily become a real pain (while most themes
continue to use 'left' and 'right'.)
Of course, we can implement all the functionality, default everything
to 'left' and 'right', and worry about the UI later. This should be
fairly straightforward to implement and nedjo's patch looks like a
first step in the right direction.
------------------------------------------------------------------------
April 17, 2005 - 17:09 : nedjo
I agree with the suggested approach of themes registering their regions.
I'd see this happening when a particular theme is activiated (or
upgraded). Regions would be an array of names (e.g., 'left', 'right',
'footer'). New records would be created in the region table only for
region names not previously registered.
Some areas I'm not clear on, or that need further work:
* Table naming
Should a new table be 'region' or 'regions' (I've used 'region')? I
don't see a convention among existing table names, some of which are
singular and others plural.
* Default values
I've kept the existing '0' and '1' ids for regions (left and right,
respectively), for backward compatibility. But this means we can't use
autoincrement for the region id (rid), since autoincrements seem to
begin with 1. Likely we should change to autogenerated ids.
* Initial records
Using the INSERT INTO statements as I've done for the initial region
entries is probably counterproductive, since sooner or later they'll
have to be dynamically generated. I was hoping this could be a
preliminary patch, with the main work coming later, but likely we need
to solve region registration by themes before this patch is applied. I
don't have a good idea of how region registration by themes would be
implemented (a hook on theme activation?), and invite suggestions or
implementations.
* Theme system changes
Besides region registration, the other change I'm seeing that would be
needed in the theme system is loading blocks by region name, rather
than region id. This is because the ids currently used ('0' and '1')
in theory might be diffferent on a particular install.
------------------------------------------------------------------------
April 17, 2005 - 17:18 : syscrusher
Instead of having themes "register" their regions, why not just add a
theme API hook called them_regions() that returns an associative array
of $region_name=>t($region_helptext)? This would be in keeping with
other similar API functions, such as those that return what permissions
apply to a module or what node types are defined by a module. Most
themes are going to define only a small number of regions (two being
the typical case now, but I could see five or six in a complex theme),
so returning a constant array will be faster than querying SQL to
obtain an array of rows.
There could be (optionally, at the discretion of whoever builds this
thing) another API hook like theme_region_properties($region_name) that
returns an associative array with detailed info for a given region, such
as extended help text with recommended usage instructions for the
region.
Scott
------------------------------------------------------------------------
April 17, 2005 - 17:19 : syscrusher
s/them_regions/theme_regions/g
------------------------------------------------------------------------
April 17, 2005 - 18:47 : adrian
Because. The most common 'theme' is a phptemplate theme.
And there needs to be a generic method for specifying the regions
available, in a non hook_function format..
Themes get their names from the directory in which they are contained..
when copying the theme to another directory, there must be _no_
modifications necessary to allow normal usage. This is one of the
tenets of the new template system I designed.
You would need a standard way to define meta-information for themes,
that does not need to be modified when copied to a new directory. We
are working on this in the install system work, as you need a way
external of Drupal to define the module dependencies and some other
things.
My approach would be to add a theme.dsc text file to the directory,
which would allow you to specify meta-information. For instance :
----
regions: left, right, footer, center, mountie
author: Johnny McAngstyPants
----
------------------------------------------------------------------------
April 17, 2005 - 22:00 : syscrusher
Adrian wrote:
"
Themes get their names from the directory in which they are contained..
when copying the theme to another directory, there must be _no_
modifications necessary to allow normal usage. This is one of the
tenets of the new template system I designed.
"
A very good point. But region names don't have to be unique across
different themes, so my hook function wouldn't have to be modified. The
suggestion I made for the mapping metadata was three factors: theme ID
or name, region ID or name, and block ID (plus one non-key weight value
to order the blocks within a region, but this is not relevant here).
I'm not familiar enough with PHP template to be able to respond to your
comments on that one, so if you say it's not feasible to work with my
schema, then I'll take your word for it. :-)
Scott
------------------------------------------------------------------------
April 17, 2005 - 22:03 : syscrusher
Oh, wait.....I see now what you mean! It's not the output of the
function that is the problem, but the *name* of the function.
Never mind. I concede your point.
Scott
------------------------------------------------------------------------
April 18, 2005 - 03:44 : Jaza
I'm probably jumping ahead a bit here... but something that this patch
will have to eventually account for, is how to allow regions to be
defined as inline. Allowing a theme to define a region's position as
being anywhere on the edge of the page (i.e. top, left, right, bottom,
corners, etc) is relatively easy. But what about having a region that's
in the middle of a node's body, or somewhere else that's not the edge of
the page?
What I'm thinking of, is eventually allowing the custom region system
to integrate with the CCK. Like I said, I admit that I'm jumping ahead
into the future - the CCK still has a long way to go before it's ready.
But ultimately, it would be cool if a theme could define a region as
being after, say, the "rating" field in nodes of type "movie review".
This would make the region (and the blocks in it) truly inline and in
context with the actual content of the node.
This would be a huge step forward compared to the current block system,
which doesn't allow you to mix the presentation of blocks and nodes at
all. In Drupal ATM, blocks and "the rest of the page" are totally
separate, and really you have no choice but to display them as such.
The result of this is that information in blocks that really should be
displayed as part of a node, gets literally "pushed to the side", and
always seems secondary to the actual content. Often the block has
content that is just as important as the content of the node itself.
Another option (of less merit, IMO - because of the extra maintenance
work, and lack of enforced consistency) would be to have a region
filter. You could then choose where to place an inline region on a
per-node basis, by entering text such as [region:2] (example based on
image_filter syntax) into the node body.
Anyway, just thought I'd throw that idea into the open. I don't expect
it will be implemented any time soon, but it's something to think
about.
Jeremy
------------------------------------------------------------------------
April 18, 2005 - 04:54 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions---possibility-1.png (1.29 KB)
Imo the 'regions' are more than you guys name here.. FOr example I
attached 2 screens which only shows you the regions.. What I think is
that it should always be possible to have free names for the regions.
No matter if i call - the region where my content appears in -
'content' or 'site items'..
See attached screens..
------------------------------------------------------------------------
April 18, 2005 - 04:56 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions---possibility-2.png (1.39 KB)
And the second...
See these links:
- http://drupal.org/files/issues/regions---possibility-1.png
- http://drupal.org/files/issues/regions---possibility-2.png
------------------------------------------------------------------------
April 18, 2005 - 11:22 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions2.patch (13.39 KB)
Here's a revised patch implementing some of the ideas so far. I've used
the theme engine - rather than individual themes - to generate the list
of available regions. I know this isn't ideal, but e.g. for xtemplate
it's at present the only option--no logic is possible in the individual
theme.
region is changed to a varchar field from the current tinyint.
I've roughed in several regions--really just for demo purposes. More
thought and work would be needed to refine them (e.g., styling, etc.).
But this maybe moves the conversation forward.
------------------------------------------------------------------------
April 18, 2005 - 17:26 : Dries
This patch enables different regions to be used. That is a good thing.
The next question is: should we take into account that different themes
could assign blocks to different regions? Lots of problems would be
solved if (i) there could only be one active theme on a website or (ii)
if all themes would have a common set of regions.
(This "let users select their own theme"-thing is a left-over from the
early days, except for WAP stuff maybe.)
------------------------------------------------------------------------
April 18, 2005 - 17:37 : killes(a)www.drop.org
Giving up multiple theme support would be a great thing. People could
still select from multiple style sheets. WAP shoud not be a user
preference setting, but automatically detected and redirected to a
special site with a WAP theme.
------------------------------------------------------------------------
April 18, 2005 - 17:48 : adrian
You would then lose the ability to make a special front page theme for
use with the sections module, for instance.
Also, currently styles exist in the same namespace as themes, and we
would have to make more a distinction of styles vs templates (or
themes), but I do think this could help simplify things.
------------------------------------------------------------------------
April 21, 2005 - 12:54 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions3.patch (15.69 KB)
The main issue raised, if I'm understanding well: if a theme or theme
engine is present that offers regions other than those available in the
default theme, any blocks assigned to those regions will be invisible to
most users.
Here's a revised patch addressing the concern. I've added a test for
each region to see whether it's also available in the current default
theme. (Actually, I'm realizing as I write this, I've used the theme
engine--so it would need to be updated to test first if an engine is
being used.)
In any case, any regions not available by default are starred, and a
message text appears (only if necessary).
If there's support for the approach, I'd be happy to finish the patch.
Remaining work:
* extend to work with non-engine themes
* finalize base set of regions to implement
* implement common region set in all core themes (for now I've only
done xtemplate)
* work on CSS display (how blocks in each region should look)
This last point I'm not too confident on and would look for
help/suggestions.
Screenshot to come.
------------------------------------------------------------------------
April 21, 2005 - 12:56 : nedjo
Attachment: http://drupal.org/files/issues/block_regions_message.png (12.34 KB)
Screenshot showing starring of non-default regions plus message.
------------------------------------------------------------------------
April 21, 2005 - 13:19 : killes(a)www.drop.org
I like that approach. +1
------------------------------------------------------------------------
April 21, 2005 - 13:23 : resmini
My two cents.
If this has to be done (and it should), better get rid of spatial
definitions for areas such as left, right, top, bottom, etc.
Use semantic names related to content and let the theme take care of
their positioning interely.
Also note that there in an ongoing debate in IA trying to build up a
standard naming convention for page regions in a way that is
semantically (and logically) correct. Just for the sake of it, you can
check
http://www.stuffandnonsense.co.uk/archives/whats_in_a_name.html
http://www.stuffandnonsense.co.uk/archives/whats_in_a_name_pt2.html
with follow-ups, including Eric Meyer's. There are more substantial
contributes in the AIfIA web site, but I can't seem to find them now.
I'll post a link or an abstract if I manage to.
--
vector at exea dot it
------------------------------------------------------------------------
April 21, 2005 - 14:15 : nedjo
Good points, useful references. The default regions I'm thinking of
are:
'banner' => t('banner'),
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
'footer' => t('footer')
Perhaps "body" would be better as "content"? It would be easy enough
to add in more regions, e.g., within the content (after title, after
help, etc.) One issue is that many of these regions will already have
rendered content. Should the blocks come before or after that other
content? I've assumed after for banner and footer, while giving both
options in body.
In any case, refinements or suggestions would be great.
------------------------------------------------------------------------
April 21, 2005 - 14:56 : resmini
Well,
'banner' => t('banner'),
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
'footer' => t('footer')
The classic (as far as classic goes for something Web related) scheme
comprises 5 spatial regions, much like stefan's
http://drupal.org/files/issues/regions---possibility-1.png with a left
area mirroring the one called 'blocks'. Call them top, left, center,
right, bottom.
Variants usually exclude one or more of these, layout-wise.
If we talk content (semantic) instead, things get a bit more
complicated, as these spatial regions normally include more than one
content-area. The top, for example, could include ad banners and the
site's header, or the main menu. But these merge seamlessly with CSS
definitions, which are definitely something that should get properly
standardized (most of the errors / inconsistencies I'm encountering
with Drupal today are related to this), but this is out of scope in
this thread.
What I somewhat object to the definitions above is that it mixes the
two approaches.
'banner' is not spatial, is content, as it is the distinction between
body top and bottom. If 'banner' goes there, it is 'top', whatever that
might be. I designed a couple of web sites which had
headers/logos/banners at the bottom of the page, and I'm not exactly
the wildest designer you'll probably meet.
And if we include body_top and _bottom, we should also add
'navigation', or 'menu' and some other content-related semantic region
(impressum, or company_data, or whatever).
I suggest that either we go along
'top' => t('banner'),
'left' => t('left sidebar'),
'center' => t('body'),
'right' => t('right sidebar'),
'bottom' => t('footer')
or we dedicate some time to detailing what could possibly fit there
semantically, which is perfectly possible without limiting design
freedom or whatever, since the vocabulary is not infinite, but not
something you do out of the blue.
Please note that I understand t('something') to be an example, since
such a layout only defines regions on the page, not semantic regions.
My main content could fit nicely in the bottom region.
As for the names for the regions, they are not important, as much as
they are coherent and enforced.
------------------------------------------------------------------------
April 21, 2005 - 17:16 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions-final.png (2.39 KB)
Maybe something like this???
But, I have to say that I _really_ liked the solution to split the
'content'-region into the 'content' and 'beneath content'.. I love
that!
------------------------------------------------------------------------
April 21, 2005 - 18:20 : resmini
Stefan, yes.
That's basically what you can build if you stick with spatial, and this
layout can generate quite an amount of (sane) layout variations even if
you interpret it strictly (suppose a default) as
<div id="header">
</div>
<div id="left-bar">
</div>
<div id="content">
</div>
<div id="right-bar">
</div>
<div id="footer">
</div>
What you can do with this is left basically to the theme designers and
their use of CSS, CSS-P or tables (brrr), but this could be an easy and
proper way to identify macro-regions in which more accurate positioning
happens at a more specific level.
I'm all in favour of subsequent identification of sub-areas (top and
bottom in body), but I don't think it would be a good idea to mix the
different approaches I mentioned in my previous post.
A site with lots of things going on or which is not just blogging
surely has the need to use its content area in a wiser manner than just
putting there 'content', the number of modules doing precisely this is
more than proof, but that falls more in a 'Drupal definitive guide to
semantics', in which CSS selectors are used or suggested strategically
for such a scope.
>From this point of view and for the sake of this thread, any unique
area / div (#name) could (should?) be a target for blocks, and this in
my opinion (*) would be the perfect solution, but I do not know if and
how this is even remotely possible in the current Drupal.
(*) It's quite late, local time, and it was a looong working day.
------------------------------------------------------------------------
April 21, 2005 - 18:38 : resmini
Attachment: http://drupal.org/files/issues/regions-final-variation.png (1.9 KB)
Just to be clear, I add a variation of stefan's scheme that shows how
this is *not* by any means positional, but spatial, or better
relational. Use your CSS imagination to take out regions, reduce them
to empty containers, enlarge them, make them taller, shorter, whatever.
5 regions, do what you like.
------------------------------------------------------------------------
April 21, 2005 - 18:44 : resmini
Sorry, I forgot.
And this is also why I'm not too keen on calling anything 'content'. If
I enlarge my right region enough, why not put my content there?
Shouldn't this be a theme-level concern?
It's nothing serious, but if my center area is called 'center' (or
something similar and more sexy), I won't confuse anybody.
This is left, center, right: do with them what you prefer. Content in
the bottom? Show me.
If I call something 'content', I'm more than suggesting that content
goes there, and only there.
------------------------------------------------------------------------
April 22, 2005 - 04:17 : stefan nagtegaal
Resmini, maybe it is only me but I think that you are making a mistake
in your way of thinking..
I get the feeling that you're mixing the 'regions' and 'divs'.. the
'regioins' should have meaningfull sentences, but the divs
shouldn'thave..
As an example:
$region_name => $content_body
here we go:
'header' => $logo
'left sidebar' => theme('blocks', 'left')
'right sidebar' => theme('blocks', 'right')
'content' => $content
'footer' => $footer.
So, $region_name does not have to be equal to the id or class of the
divs..
------------------------------------------------------------------------
April 22, 2005 - 05:27 : resmini
Stefan,
>So, $region_name does not have to be equal to the id or class of the
divs..
Yes, absolutely. I probably didn't make myself very clear: what I'm
trying to point out is that in
'header' => $logo
'left sidebar' => theme('blocks', 'left')
'right sidebar' => theme('blocks', 'right')
'content' => $content
'footer' => $footer.
there is no reason at all to call 'content' the region that holds
$content.
nedjo asked in #24
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
if /Perhaps "body" would be better as "content"?/ and all my reasoning
is simply that no, that is not content, or it shouldn't be (or better:
it may happen that main content is elsewhere). As a matter of fact,
even the connotation 'sidebar' doesn't fit very well logically.
To make it short: Today's method works, but has limits. Mambo, which
paragkenia quotes at the beginning, handles more 'user regions' but in
pure Mambo style conventions are so loose that they are hardly useful.
If we define regions, as in nedjo's example, in my opinion these
regions shouldn't imply informational layouting, only relational
positioning (that is, where they stay in the browser viewport).
I know it may look like overdesigning, but Drupal constantly enforces
conventions and coding guidelines everywhere: this is one of the best
aspects of the project and I think it should carry to the layout.
------------------------------------------------------------------------
April 22, 2005 - 05:32 : stefan nagtegaal
While I think that 'body_*' is not as self explaining as 'content_*' I
vote for using 'content_*'..
------------------------------------------------------------------------
April 25, 2005 - 13:48 : chx
Let's get back to the code. If my understanding is correct the big
discussion is about how to name potiental rectangular areas _after_
this is commited. So, first get this committed. What's need to make
that happen?
------------------------------------------------------------------------
April 25, 2005 - 14:56 : chx
I spoke with Moshe, Steven, JonBob and the result is: keys shall be
numbers, and themes shall define the values. We will make region zero
and one required. There will be a define('REGION_CONTENT', 0) and a
define('REGION_SIDEBAR', 1); so you can have readable code still.
Either wait for me to code it or feel to do it yourself, just drop me a
mail via the contact form if you are doing it.
------------------------------------------------------------------------
April 27, 2005 - 12:14 : nedjo
Károly, it's great if you're willing to take on finishing this. I
tried to summarize remaining work in update 20, above [4].
The numerical keys look fine to me.
In terms of an initial default set of regions, one quirk is this: for
now, so far as I can see (and assuming the approach I sketched in),
available regions can be defined only in (a) theme engines and (b)
individual themes that don't use an engine. So, for instance, an
individual xtemplate based theme can't define its own custom regions;
they need to be defined in the theme engine. (Unless and until the
whole theme system should switch to the sort of configuration file
adrian suggested above [5].)
Which is to say that, under this approach, we'll be defining a set of
regions for each engine, and then all themes using that engine should
try to implement those regions. (Otherwise, if a site admin selects a
region defined in the engine but not implemented in the default theme,
the content won't appear.)
Please let me know if there's anything in what I've done that isn't
clear, or if you want to pass some or all of this back.
Thanks!
[4] http://www.drupal.org/node/16216#comment-27398
[5] http://www.drupal.org/node/16216#comment-27052
------------------------------------------------------------------------
May 9, 2005 - 16:36 : chx
I had a "short" discussion with the UI team leader ie. Ber Kessels. The
outcoming is that we will change hook_block so that it uses callbacks a
bit like menu system. Here's an example:
<?php
function module_block() {
$items = array();
$items['module_header'] = array('callback' => 'mymodule_page',
'weight' => -50, 'region' => 'content' , 'cache' => TRUE, 'pages' =>
"node/*\n<front>");
return $items;
}
?>
Please note that we are allowing caching the themed output of each
block independently.
The theme system will execute hook_block as it does now and it'll
execute the callbacks defined in module_block as well. Of course if the
callback is cacheable and in the cache, it'll print it from cache. If
it's themeable and not in the cache, it'll cache it before printing.
Pages contains a string (could be PHP code!) which can be overriden in
the block configuration screen.
Callbacks defined in hook_menu will have lot less functionality after
this, they will be used for non-themed pages mainly.
------------------------------------------------------------------------
May 9, 2005 - 16:45 : chx
More explanation is requested for the example.
module_header is the unqiue name of the block.
pages define on which pages the block is visible. ('pages' in the block
configuration screen.) Maybe I'll implement 'visibility' from the same
screen as well.
callback, weight are well known Drupal terms.
cache is a boolean which defines whether given output is cacheable or
not.
------------------------------------------------------------------------
May 9, 2005 - 16:47 : chx
Ber, Dries, do not kill me! Ber chaired the usability meeting in
Antwerp, that's all.
------------------------------------------------------------------------
May 9, 2005 - 16:52 : Bèr Kessels
Attachment: http://drupal.org/files/issues/more_regions_principle.png (123.29 KB)
attached is a schematic which might clarify this a little.
And I would also like to comment on me being the UI leader: I do not
consider myself any leader, no ofeence, though. Just to clarify that.
------------------------------------------------------------------------
May 9, 2005 - 18:42 : nedjo
I am not opposed to the idea of changing the _block() hook to use
callbacks (I have no opinion on it, not immediately grasping the need),
but this seems quite distinct from the aim of enabling multiple and
extensible regions. Why can't we just move ahead with the block
generalization?
I suggest:
* quickly implement the proposed block region generalization, using
only the two existing regions (i.e., implementing them in core themes)
* later worry about:
- adding further regions (the details of which are best done by those
primarily responsible for the particular themes)
- possible changes to the _block() hook.
Wouldn't this make sense? Or am I missing some pressing reason for
which the block generalization has to wait?
------------------------------------------------------------------------
May 9, 2005 - 21:28 : killes(a)www.drop.org
"Or am I missing some pressing reason for which the block generalization
has to wait?"
I might be missing something too, but I thought Chx was just talking
about the block generalization and proposing a way to code it.
------------------------------------------------------------------------
May 9, 2005 - 22:41 : factoryjoe
I wanted to chime in with this discussion because it's an important one
and has some really huge implications for Drupal moving forward. That
said, I also have a day job pulling all my attention which means that
the big ideas I have for this problem can't be put into a complete
visual form for at least a week or more. In the meantime, I'd like to
offer a few thoughts on the matter.
* *Regions do not belong in themes.* Blocks were originally separate
from themes for a reason. Themes should define the general look and
feel of a site -- and to some extent a site's behavior. Layouts which
define the spatial relationship between regions belong in some
intermediary between style and content, which does not currently exist
in Drupal.
* I would propose that *layouts become a new kind of CCK tool.* By that
I mean that they can be defined, shared and deployed very easily -- even
as simply as tossing a directory of some .layout textfiles into a
layouts/ directory. Note that this suggestion has nothing to do with
the way CCK /might actually/ work right now; instead I'm suggesting how
I would like it to work. I would like, for example, to create a CCK item
like a "person" and ship it with a .layout file that carries all the
semantic goodness needed to output that "person" to the screen in
juicy, semantic markup... which anyone can come along and theme to
their heart's content.
* *Creating shareable layouts should be relatively painless.* Dashboard
[6] sets the bar for easy hackability. It should be that easy to create
layouts for Drupal... I can imagine creating an "iTunes layout" or an
"Image Gallery" layout and so on... If we used something akin to PHPTal
to develop the layouts, we could keep development fairly standard while
making it possible for more folks to hack up cool and innovative
layouts.
* *Layouts should be extensible.. to a degree.* I see a huge problem
with how this discussion has floated back and forth between semantic
and spatial region naming. Because we talk about this problem in those
terms, we fail to identify the real problem and opportunities presented
to us. Here's the thing: when you predefine regions, you limit
creativity and the ability of people to really use the system. On the
other hand, when you make a system too flexibile, it quickly becomes
unwieldy. In all the mockups presented above, both classes of problems
would arise. Therefore we need to think about a way to stay flexibile
while "taming the beast."
* To that end, I suggest developing *self-contained layouts that are
contextually-complete.* So for the example of the iTunes search
layout... you would know before hand that you get a couple multiple
select boxes that you can hook up to whatever taxonomies you want to
progressively filter [nodes]. You could even change the .layout file,
allowing you to theme it to your liking -- even though that would
totally optional, given the layout's internal default styling. Once
you've got your layout, you would go into a layout module UI [7],
create a new layout [8], select the layout from a list [9] and then
give it a path so you can access the layout... You would then walk
through a wizard [10] that would help you populate that layout with all
kinds of nice Drupally goodies... feeds, node listings, PHP code, etc.
The power in this approach is multifold. For one, it snaps Drupal out
of its block mentality and allows designers to really innovate with
individual page designs. In fact, I've already thought out how I could
reimplement Flickr using this system, combined with Drupal's native
feeds, taxonomy and menu module, and I'd barely break a sweat... sort
of. ;)
But anyway, this is a very productive conversation to be having, but I
really think that we should consider whether the old paradigm, as such,
really pushes Drupal as far forward as we have the opportunity to go.
[6] http://drupal.org/apple.com/macosx/theater/dashboard.html
[7] http://photos4.flickr.com/6944826_90af237c99_o.png
[8] http://www.factorycity.net/demos/civicspace/layout/new.html
[9] http://www.factorycity.net/demos/civicspace/layout/new_layout.html
[10]
http://www.factorycity.net/demos/civicspace/layout/testing_add.html
------------------------------------------------------------------------
May 10, 2005 - 00:34 : chx
While factoryjoe may be right, I could be right as well.
Regions has definitely something to do with themes, after all it's the
theme that renders the page, and it can only render regions that it
knows of.
So, instead of postponing this into the far future when someone comes
out with a layout system, I code this now.
------------------------------------------------------------------------
May 10, 2005 - 01:22 : Dries
The proposed 'weight', 'region' and 'pages' would be configurable, not?
Are these just defaults? The 'callback' and 'cache' options are nice to
have.
------------------------------------------------------------------------
May 10, 2005 - 01:25 : chx
Yes, blocks can provide a default for everything on the block and and
configuration screen. Of course, you can override these in the UI.
------------------------------------------------------------------------
May 10, 2005 - 05:02 : Bèr Kessels
Dries: yes, the region, weight and pages will be configurable from an
admin interface. What we tried to address here, is a method for
developers to choose good defaults. Take for example "logo". that
should be enabled by default in a regions called header, rendered on
all pages, and have a very light weight. We should not force an admin
to visit the blocks admin before she can see or use the logo.
Chris: I do not know if you have ever tried typo3. Its concept is some
form of builder system. I do not like thar, because far too complex. If
we ever get sme kind of builder in core (if ever) it will require a lot
of work, and even more usability research. So for now such a builder is
far out of our reach. Lets aim at goals that are more realistic ;) So:
it does belong in themes, its the best place that is still realistic.
I do like your visions, Chris, but I hope you agree they are not
realistic, yet. So, maybe you can think of a path towards your visions,
ow we can reach such a builder-system, you describe?
------------------------------------------------------------------------
May 10, 2005 - 10:52 : factoryjoe
My browser crashed before I was able to submit my followup to chx's
comment... I have no problem with the current work going forward and am
happy to see it happening. I know that my ideas are typically
outlandlish and far off... That's the kind of design I enjoy doing!
In any case, I see chx's solution being a means to an end; once we have
abstracted the region code, it become much easier for me to get some
help creating my vision.
In the meantime, and as a demonstration of how I see this layout system
working (to answer, I hope, Ber's concerns about clunkiness), I've
created a workflow movie that shows off how fast you'd be able to add
content to the system.
Check it out:
http://factorycity.net/demos/civicspace/layout/media/layout_workflow_v1.mov
Feedback appreciated. And, if you want to try the demo out yourself
(it's all hardcoded, like a "movie set" for my UI), go here:
http://factorycity.net/demos/civicspace/layout/
------------------------------------------------------------------------
May 12, 2005 - 12:45 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions4.patch (13.56 KB)
"I might be missing something too, but I thought Chx was just talking
about the block generalization and proposing a way to code it.
"
Well, if I can say so respectfully, I don't think so. Not so far as I
can see identifying problems with my original patch, this interesting
discussion is rather addressing the (useful, but logically subsequent)
question "once we have multiple regions, how should we work with
them?". It's perhaps demonstrating our propensity to try to do more
rather than less with a given patch--to talk for a long time when a
first step solution is already in place. So here is a (yes, interim!)
small, focused, and tested patch to remove the hard-coded regions.
I've stripped it down so it does nothing more than (a) make block
regions declared by themes rather than hard-coded and (b) implement the
existing left and right regions in existing core themes. Please, try it
out, I think you'll like it. I'm of the (I'm hoping not scandalous)
opinion that it can be applied right away, and so clear the way for
further progress. In particular, this patch leaves the adding and
configuring of additional regions to theme authors/maintainers, who are
best qualified for the work.
"I spoke with Moshe, Steven, JonBob and the result is: keys shall be
numbers, and themes shall define the values. We will make region zero
and one required.
"
The reason I moved from numbers to strings (e.g., "left") is that a
theme author defining regions has no way of knowing what regions might
have already been defined, and therefore what integers might have
aleady been used. It's like module and theme names--we'd have to use
random numbers to avoid conflicts, so we're better off with string
names.
------------------------------------------------------------------------
May 12, 2005 - 14:17 : Bèr Kessels
nedjo,
I am not a fan of your solution for blocks that dissapear. It breaks
the ability to allow more themes on a site. if important blocks dont
show up, your site will simply break. I would rather suggest that every
theme MUST have a region called 'default'. any blocks that want to go
into a non-existing region, will be placed there.
We must define a standard listy of suggested region names. to avoid a
wildgrowth of names.
I am not sure if i like the way you do function phptemplate_regions().
these regions should be defined in the templqtes, not the engine.
Otherwise all phptemplate themes will still all have two regions.
Note that i did not test your patch thouroughly, just applied and
looked at.
------------------------------------------------------------------------
May 12, 2005 - 15:38 : nedjo
Thanks for your comments. I think we're getting somewhere.
"I am not a fan of your solution for blocks that dissapear. It breaks
the ability to allow more themes on a site. if important blocks dont
show up, your site will simply break. I would rather suggest that every
theme MUST have a region called 'default'. any blocks that want to go
into a non-existing region, will be placed there.
"
Good suggestion. Having a default region for blocks to show up sounds
like a valuable backup. I'm thinking we might want to have a way to
designate a given region as the default, rather than having to have one
named 'default'. Thoughts?
"We must define a standard listy of suggested region names. to avoid a
wildgrowth of names.
"
Sure. But the patch doesn't prevent doing that--it enables it.
"I am not sure if i like the way you do function phptemplate_regions().
these regions should be defined in the templqtes, not the engine.
Otherwise all phptemplate themes will still all have two regions.
"
Oh, I wholeheartedly agree, and I've noted the issue above. But unless
we substantially rewrite the engines, some region definition is needed
in the engines, as they call blocks. Should we therefore define a base
set in the engine, then call a hook from the engine to add any other
regions from themes based on that engine? If so, where in the theme's
files should such a hook be located?
And a side note. Do let's make an effort to keep our comments
friendly. Taking the time to note one or two things that do work or
are done well as part of a review is I believe a valuable habit. It
helps to confirm what is indeed accomplished. Beyond this, it helps to
maintain the idea that we are collaborating on shared goals, rather than
pushing individual and competing visions, and that contributions and
work are appreciated, rather than being invitations to criticism.
Thanks, Nedjo
------------------------------------------------------------------------
May 12, 2005 - 15:42 : chx
I am implementing http://drupal.org/node/16216#comment-29282 but it
takes time. regions again have names. default and sidebar regions are
mandatory.
This has little to do with nedjo's code much more with his idea -- I
looked at the screenshot and said, OK this is great but... we'd like to
have a lot more 'blocks' if this comes through, henceforth the above
mentioned solution.
------------------------------------------------------------------------
May 12, 2005 - 16:39 : nedjo
Okay, thanks for the clarification, I hadn't understood that you were
taking a new approach rather than building on what I'd begun. Given
that that's the case, staging as I'd suggested obviously won't work so
I'm content to wait and see what you accomplish. I'd only suggest,
don't feel like you need necessarily to do everything all at once.
------------------------------------------------------------------------
May 13, 2005 - 04:34 : Bèr Kessels
Nedjo, sorry if the sound of my comment was hostile. it was never meant
to be that way. I am busy, and thus did not want to comment all the
things i liked about your patch, but chose to pick the much smaller
amount of things I thought could use some improvement. I will try to
keep in mind to be more friendly next times. Also, not all of us are as
fluent in English as our native English speakers. I think its good to
keep in mind that for a lot of us, communication in English is not as
easy as it may seem. For me, it often requires a lot of concentration
to get the subtleties right. I mean: I can type some English text, look
up words in the dictionary, but to get small yet important subtleties in
my texts is very hard, often.
But, that all said: I liked your patch.
------------------------------------------------------------------------
June 10, 2005 - 07:08 : jakeg
How far off is this from being officially released or at least usable?
If its usable now, what files will I need to implement it?
------------------------------------------------------------------------
June 10, 2005 - 08:19 : Kobus
Attachment: http://drupal.org/files/issues/regions---possibility-3.png (2.21 KB)
To add to Stefan's suggestions with the two screenshots, I modified one
of them a bit, and this is how I understand Jaza's post, and yes, I
agree, this would be a wonderful feature! I can't wait! Imagine how
good it would look if I had a theme that has a clear white background
(not visible blocks) and then these seemingly random boxes on the page,
as shown in the screenshot. Especially where I can place it anywhere
around the node like Jaza said with a [region:2] block etc.
I say again: I can't wait!
Kobus
------------------------------------------------------------------------
June 10, 2005 - 09:59 : chx
I need 3-4 hrs of peace to implement the callback based thing. That's a
lot these days. Let's hope I'll get on it in the following days.
------------------------------------------------------------------------
June 18, 2005 - 18:32 : chx
Here's an example again of how hook_block will look like:
<?php
function module_block() {
$items = array();
$items['module_header'] = array('callback' =>
'mymodule_function', 'callback arguments' => arg(1), 'weight' => -50,
'region' => 'content', 'cache' => TRUE, ''pages' => "node/*\n<front>");
return $items;
}
?>
Items are keyed by unique IDs. The template system will call
module_invoke_all('block'), put the rendered HTML of the blocks into
regions sorted by weight. The rendered HTML is cached if it is allowed.
More keys will be introduced later, but now basically we just throw
everything from block configure in here, and add callback, callback
arguments, region.
Node teasers or fullly rendered nodes are blocks, too. Almost
everything is. So, here what happens when we are on taxonomy/term/1:
taxonomy_render_nodes is called
it calls block_set('node_view', $weight, $node, $teaser, $page); a few
times, so a few node_view blocks will be on the page
later the theme system is invoked. It will ask the block system to
collect all blocks, dynamic and the static blocks as well. For all
dynamic blocks we have a block defined in hook_block somewhere, like
the definition above, with one exception: it will have a 'standalone'
=> FALSE pair, so it is not a standalone block which is automatically
rendered but something that needs to explicitely requested. Also, we
may define a 'suffix' => 'somefunction' pair which provides us with a
cache ID suffix. Look at the code below:
<?php
function block_collect_blocks() {
// get all block definitions
$static_blocks = module_invoke_all('block');
// iterate of the dynamic blocks set on the page
foreach (block_get() as $dynamic_block) {
// get the block definition for the given dynamic block
$static_block = $static_blocks[$dynamic_block['block']];
// merge the callback arguments from the dynamic and static.
dynamic_block['callback arguments'] is always set though
// may be empty
if (isset($static_block['callback arguments'])) {
$dynamic_block['callback arguments'] =
array_merge($static_block['arguments'], $dynamic_block['callback
arguments']);
}
// try to get a cache ID suffix
$suffix = function_exists($static_block['suffix']) &&
call_user_func_array($static_block['suffix'], $dynamic_block['callback
arguments']);
// if the block is cacheable or the suffix function says that
it is cacheable by setting a suffix
if ($static_block['cache'] || $suffix) {
// set cache ID
$cid = 'block:'. $dynamic_block['block'] .':'. $suffix;
// try to get the rendered HTML from cache
if ($block_rendered = cache_get($cid)) {
$return[$static_block['region'][$dynamic_block['weight']][]
= $static_block_rendered;
continue;
}
}
// render the block
$block_rendered =
call_user_func_array($static_block['callback'],
$dynamic_block['callback arguments']);
// store the block for return
$return[$static_block['region'][$dynamic_block['weight']][] =
$static_block_rendered;
if ($static_block['cache'] || $suffix) {
// if cacheable, do it
cache_set($cid, $static_block_rendered);
}
}
foreach ($static_blocks as $key => $static_block) {
// is this a stand alone block, like in Drupal 4.6?
if ($static_block['standalone']) {
// now, the above is repeated, save that we do not have a
dynamic_block here
$suffix = function_exists($static_block['suffix']) &&
call_user_func_array($static_block['suffix'], $static_block['callback
arguments']);
if ($static_block['cache'] || $suffix) {
$cid = "block:$key:$suffix";
if ($block_rendered = cache_get($cid)) {
$return[$static_block['region'][$static_block['weight']][]
= $static_block_rendered;
continue;
}
}
$block_rendered =
call_user_func_array($static_block['callback'], $static_block['callback
arguments']);
$return[$static_block['region']][$static_block['weight']][]
= $static_block_rendered;
if ($static_block['cache'] || $suffix) {
cache_set($cid, $static_block_rendered);
}
}
}
}
function block_set() {
static $blocks;
$args = func_get_args();
if (count($args)) {
$callback = array_shift($args);
$weight = array_shift($args);
$blocks[] = array('block' => $function, 'weight' => $weight,
'callback arguments' => $args);
}
return $blocks;
}
function block_get() {
return block_set();
}
?>
When to expire the block cache? Never. If functions can call
cache_clear all, they can be smart enough to cache_clear only those
blocks that are changed by them. Some blocks won't be cacheable
anyways, say there is little use in caching 'active forum topics'
------------------------------------------------------------------------
June 19, 2005 - 03:15 : Dries
Frankly, I don't understand what you are trying to say. What is a
'dynamic', a 'static' and a 'standalone block'? What is the suffix
for? What is the advantage of making node and taxonomy views blocks?
If there is no big advantage, this is just bloat. All in all, it looks
pretty complex to me.
If we make Drupal more flexible _and_ more complex, people will get
upset, and we end up being like Plone. Drupal's simplicity is
something to foster, as it allows people to go in, and change stuff.
The focus is to make Drupal simpler _and_ more flexible.
I merely spent 10 minutes looking at this (reading your explanation
twice, staring at the code), and the newly added complexity simply
turns me off. Maybe that is because I don't understand what we are
gaining.
------------------------------------------------------------------------
June 19, 2005 - 03:34 : Bèr Kessels
* The first thing we gain, is, very slmple: more regions.
But, how many? what regions? on what pages? in what location? bearing
which name? For all these issues we need some callback system. To allow
themers, administrators and module developers to give answers to all
these questions. what we have now: sidebars, with only admin settings,
is simply too limited: It takes serious hacking (~15 lines of code in
your theme) to get a login block in your header!
* The second thing we get for free: We are passing along chuncks of
HTML, so why not cache them in a central place.
Practice points out that our current cache is not used well. We leave
it to developers to cache. And developers are lazy by nature. Just
looks at all the places where caching should have been done, but is
not. 9/10contribs have at least one of these places.
You must actually see these issues separate. The new central blocks
pulling system, and the caching. the latter is something that we get
for free, a high level of advanced caching (how often has not been put
forward Drupal seiously lacks better/advanced caching?). But we get it
only for free if it is co-developed with the new regions blocks.
And Last but not least, everything is a block, from a themer point of
veiw. I know developers tend to think: I do the content, and do not
care about where and how it turns up. That results in a content-centric
system, what we have now. Everythng is built around aa single chunk of
content. while, in fact content, is yet another block. Look at
http://www.terminus1525.ca/index.php?l=en or
http://www.franklinpennsylvania.us/ as it stands now, its up to the
developer to concenate all the HTML in the center area, into a huge
chunk of HTML. While in fact everyone can see that these are a lot of
separate blocks.
------------------------------------------------------------------------
June 19, 2005 - 03:39 : Dries
Ber: I was talking about chx's latest changes, not the block system in
general.
------------------------------------------------------------------------
June 20, 2005 - 14:06 : nedjo
I appreciate the update on directions being contemplated, although I
find it confusing.
Again, I'd caution, let's keep focused on the aim at hand, and on a
staged solution. A bigger patch means greater complexity, more
difficulty getting meaningful review, and greater delays in getting a
priority change. We're currently in a position where we have two
hard-coded regions for blocks, a major issue if nothing else than
because it reflects poorly on Drupal's usability and versatility.
Moving from here directly to something like "everything you see
anywhere is a (nested) block in its own (nested) region" strikes me as
a bigger step than we need to take.
And in belated reply to Ber's note (#53 above [11]), thanks for the
thoughtful comments, I didn't mean to single you out and acknowledge
that language & cultural differences play a role, I feel we can all
benefit from attention to communication.
[11] http://www.drupal.org/node/16216#comment-29633
------------------------------------------------------------------------
June 21, 2005 - 15:39 : Dries
Even with the explanation in chx's sandbox, this is too complex for my
likings. Here is a suggestion: let's drop the caching and the
'suffix'-stuff. Let's also drop the 'complete' and 'incomplete' stuff.
Keep it _simple_, chx. IMO, you're creating a monster.
------------------------------------------------------------------------
June 22, 2005 - 16:47 : chx
nedjo, take over. I am out.
------------------------------------------------------------------------
June 22, 2005 - 18:51 : djnz
Quick and dirty solution? Let blocks be assignable to 9 locations - Top
left, middle, right, middle left, middle right, bottom left, middle,
right.
The actual location of these areas within a theme is up to a theme
designer, but the designer should include each of them - how about
$sidebar['tl'], $sidebar['tm'], $sidebar['tr'] ...
Backwards theme compatibility could easily be maintained by only
creating the $sidebar array if the theme has set (eg in its
template.php file for a PHPtemplate theme) a flag, otherwise generate
$sidebar_left from the blocks set (in sequence) to top left, middle
left, bottom left, top middle and middle middle (arbitrary break) with
$sidebar_right the remainder.
I appreciate I have no karma here and only superficial knowledge of the
Drupal code, but sometimes the clarity of a view unclouded by too much
information is useful ;)
------------------------------------------------------------------------
June 27, 2005 - 02:26 : nedjo
Attachment: http://drupal.org/files/issues/regioning.patch (24.74 KB)
"
nedjo, take over. I am out.
"
Um, okay. I've given the question some more thought and come to the
following conclusions:
1. If we take regions to be areas of the page that specific types of
content are rendered into, and a regioning system to be a system to
accomplish this, we already have a number of regions and different
types of regioning systems. They include:
(a) our current blocks system, and
(b) the various drupal_set_[region]() functions, like
drupal_set_comment().
(c) specialized hooks like our help system, which assembles content to
be rendered into a region.
2. LIkely we should tease out regions from blocks.
So attached is a next rough cut at regioning. Features:
* Default region is defined in general admin settings page
* Regions are defined in both engines and themes. A particular
engine-based theme has the regions it defines plus the engine's default
ones.
* Content can be written to regions in two ways: through blocks or
through drupal_set_content($region, $content) calls.
Initial comments are welcome. I'll work on getting a more polished
patch and also more explanation of the approach.
------------------------------------------------------------------------
June 27, 2005 - 02:43 : deekayen
Disclaimer: I offer no code for this, so this is just a bunch of
idealism I can't back up.
djnz's comment makes sense if you want quick and dirty, but it seems to
me the correct way to do things would be in terms of relatives. I would
think doing it right the first time would be easier than redoing block
location code twice. For example set a standard starting location;
perhaps the start is 100% height/width conceptually. If you want to put
something on the right, it would be the first block on the right of the
starting block - let the theme manage widths. Then if you want another
block on the right, or 10, just keep adding them relative to the others
kind of like the current ordering of book pages or like adding more TD
cells in a HTML table.
Using this example under the current standard layout, the main block
could be in the middle with with relative blocks on the left and right.
------------------------------------------------------------------------
June 28, 2005 - 06:26 : arnabdotorg
It would be totally awesome to see multiple regions in Drupal 5, if not
4.7.
This topic has been discussed several times before, noting them down
for reference:
http://drupal.org/node/2790 /[September 9th 2003]/
http://drupal.org/node/10653
http://drupal.org/node/13008
I also think it would be nice to have people implement multi-region
themes; see what problems we encounter, and learn from it.
------------------------------------------------------------------------
June 28, 2005 - 08:28 : arnabdotorg
Forgot to add, I've patched nedjo's final patch [12] to Drupal HEAD,
it's up at http://arnab.drupaldevs.org/ [13].
[12] http://drupal.org/files/issues/regioning.patch
[13] http://drupal.org/files/issues/regioning.patch
------------------------------------------------------------------------
June 28, 2005 - 12:57 : nedjo
Attachment: http://drupal.org/files/issues/regioning2.patch (25.03 KB)
Here's an improved version of the patch--several bug fixes, no new
functionality. There are still a couple of loose ends (e.g.,
implementing the option of particular blocks not to be themed), and I
haven't fully tested it.
Further to my previous explanation, here is a summary of what the patch
does. I'll mark as "new" the bits added in this week's iteration.
Problem addressed:
Currently, Drupal has two hard-coded regions into which block content
is rendered: left and right. This situation severely limits the
flexibility of content presentation.
Aim:
Enable multiple and extensible regions for blocks and other content.
Approach:
1. Hard coded regions are removed from block.module. Instead,
available regions are loaded dynamically.
2. Available regions are defined in themes (and, optionally, in
modules). A theme or a theme engine defines its available regions
through a themename_regions() function in themename.theme file or a
enginename_regions() function in an enginename.engine file. New:
engine-based themes can define their own regions in a .theme file.
They will have all the engine's regions plus any they define. New:
modules can define their own regions through a hook_regions() call.
This should allow modules to define and use "inline" regions. For
example, a module could define a region, then use a nodeapi() call to
load content for that block and then insert it into a formatted box in
$node->body.
3. New: the regions associated with a theme are loaded as part of the
system_theme_data() call, and available regions are loaded through a
system_region_list() function.
4. Previously stored as an integer, blocks' regions are changed to
varchar, to enable storing of strings (e.g., 'left').
5. A "default" region is defined (as a core setting), into which
content will be rendered in the case that it's assigned to a region
that's not available in the current theme. The options available for
the default region are "core" regions, defined as all those available
in all available themes. In the main block admin page, all regions not
available in the current default theme are marked with an asterix, with
an explanatory note.
1
0
[drupal-devel] [feature] Enable multiple block regions (not just "left" and "right" sidebars)
by nedjo 28 Jun '05
by nedjo 28 Jun '05
28 Jun '05
Issue status update for http://drupal.org/node/16216
Project: Drupal
Version: cvs
Component: block.module
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: paragkenia
Updated by: nedjo
Status: patch
Attachment: http://drupal.org/files/issues/regioning2.patch (25.03 KB)
Here's an improved version of the patch--several bug fixes, no new
functionality. There are still a couple of loose ends (e.g.,
implementing the option of particular blocks not to be themed), and I
haven't fully tested it.
Further to my previous explanation, here is a summary of what the patch
does. I'll mark as "new" the bits added in this week's iteration.
Problem addressed:
Currently, Drupal has two hard-coded regions into which block content
is rendered: left and right. This situation severely limits the
flexibility of content presentation.
Aim:
Enable multiple and extensible regions for blocks and other content.
Approach:
1. Hard coded regions are removed from block.module. Instead,
available regions are loaded dynamically.
2. Available regions are defined in themes (and, optionally, in
modules). A theme or a theme engine defines its available regions
through a themename_regions() function in themename.theme file or a
enginename_regions() function in an enginename.engine file. New:
engine-based themes can define their own regions in a .theme file.
They will have all the engine's regions plus any they define. New:
modules can define their own regions through a hook_regions() call.
This should allow modules to define and use "inline" regions. For
example, a module could define a region, then use a nodeapi() call to
load content for that block and then insert it into a formatted box in
$node->body.
3. New: the regions associated with a theme are loaded as part of the
system_theme_data() call, and available regions are loaded through a
system_region_list() function.
4. Previously stored as an integer, blocks' regions are changed to
varchar, to enable storing of strings (e.g., 'left').
5. A "default" region is defined (as a core setting), into which
content will be rendered in the case that it's assigned to a region
that's not available in the current theme. The options available for
the default region are "core" regions, defined as all those available
in all available themes. In the main block admin page, all regions not
available in the current default theme are marked with an asterix, with
an explanatory note.
nedjo
Previous comments:
------------------------------------------------------------------------
January 26, 2005 - 06:27 : paragkenia
I read the comparision discussion between *Drupal* and *Mambo*. In
several messages it was outlined that Drupal can place blocks only in
right and left and not flexible to put them on anywhere where one want.
It will be great if this can be changed in upcoming versions.
I am no pro at PHP, so don't know how much time this task will take,
but I think it is very important.
parag
------------------------------------------------------------------------
April 14, 2005 - 21:44 : nedjo
This issue was apparently partially addressed in issue
http://drupal.org/node/19694 [1].
[1] http://drupal.org/node/19694
------------------------------------------------------------------------
April 16, 2005 - 20:24 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions.patch (8.17 KB)
This much-requested functionality - to have the ability to place blocks
in more than the two predefined regions - was partially addressed in
issue http://drupal.org/node/19694. [2]. But "blocks" are still
limited to the "left" and "right" sidebars (hard-coded in
block.module).
This patch is a first step designed to enable multiple (eventually,
admin-definable) regions for blocks. I've moved the existing "left"
and "right" block regions to a 'region' table (with ids of 0 and 1, as
currently used in themes). Then all references to the regions are
drawn dynamically from the table. This way, if further records are
added, they will appear in the list of available regions for block
placement.
Doing this actually reduces some duplicated code, since it's no longer
necessary to repeat code blocks for each of "left" and "right".
As it stands, the patch doesn't add any new functionality--but I don't
think it breaks anything either. New functionality would need (a) new
regions defined, and (b) changes to themes. A simple first step might
be, e.g., to add a "footer" region and then add a call in the footer
generation to append any blocks assigned to the footer region there.
I'm setting this to patch, but I'm aware that it needs some discussion
and refining before it'll be ready to apply.
[2] http://drupal.org/node/19694.
------------------------------------------------------------------------
April 16, 2005 - 21:05 : nedjo
Attachment: http://drupal.org/files/issues/block_regions.png (5.65 KB)
Here's a screenshot showing the block admin page, with drop-downs for
region placement (the options are dynamically generated based on
defined regions).
------------------------------------------------------------------------
April 16, 2005 - 22:57 : adrian
The biggest problem with this is that you can have multiple themes, and
each of these themes can have different regions available.
Also, the method of defining which regions are available needs to be
standardised. Some of the work that me and Vlado are working on for the
install system would go towards solving that problem (ie: meta
information for modules, themes and styles).
This has been discussed to death, but the general consensus has been
that we _want_ to do this, but we need to solve a few other problems
properly first, the most pertinent being the interface issue. Chris
(factoryjoe) recently did a whole mess of workflows for something
related to this.
------------------------------------------------------------------------
April 17, 2005 - 00:09 : syscrusher
The first paragraph of adrian [3]'s post is a point that occurred to me
also, as I read this thread.
One suggestion would be to separate the definition and configuration of
blocks, on one hand, from the placement of those blocks, on the other
hand.
In other words, Drupal core provides a mechanism defining what blocks
exist, which of these are on by default or off by default and
user-selectable vs. which are forced on for all users, and the
configuration (if applicable) of specialized blocks defined by
particular modules.
Each theme provides a standard hook function that returns an array of
region names and help/description text, e.g., array('left'=>t('This
vertical region is left of the main content area'), 'right'=>t('This
vertical region is right of the main content area'), 'footer'=>t('The
footer is below the left, right, and main content areas of the page')).
The theme part of Drupal core (i.e., theme.module itself, not the
individual themes) provides a standard UI that is displayed within
config of *each theme* (but is one physical code base within
theme.module) that allows the administrator to map blocks defined by
Drupal core into regions defined by the theme, and storing that mapping
as an theme-to-block_ID-to-region_ID (with weight) table in the
database. From there, the actual page rendering is similar to what's
being done now, but there is more of it.
I guess what I'm trying to say is that the key to solving this problem
is breaking it along its degrees of orthogonality, and there are three
-- two in Drupal core and one in the individual theme.
Scott
[3] http://drupal.org//user/1517
------------------------------------------------------------------------
April 17, 2005 - 03:14 : Dries
Scott, is right. The theme should export its available regions. Then
the administrator's task is to assign blocks to regions (not to setup
regions). A theme could have configurable regions, but that internal
to the theme.
To me, the real challenge is the UI and the interaction design.
Configuring blocks could easily become a real pain (while most themes
continue to use 'left' and 'right'.)
Of course, we can implement all the functionality, default everything
to 'left' and 'right', and worry about the UI later. This should be
fairly straightforward to implement and nedjo's patch looks like a
first step in the right direction.
------------------------------------------------------------------------
April 17, 2005 - 17:09 : nedjo
I agree with the suggested approach of themes registering their regions.
I'd see this happening when a particular theme is activiated (or
upgraded). Regions would be an array of names (e.g., 'left', 'right',
'footer'). New records would be created in the region table only for
region names not previously registered.
Some areas I'm not clear on, or that need further work:
* Table naming
Should a new table be 'region' or 'regions' (I've used 'region')? I
don't see a convention among existing table names, some of which are
singular and others plural.
* Default values
I've kept the existing '0' and '1' ids for regions (left and right,
respectively), for backward compatibility. But this means we can't use
autoincrement for the region id (rid), since autoincrements seem to
begin with 1. Likely we should change to autogenerated ids.
* Initial records
Using the INSERT INTO statements as I've done for the initial region
entries is probably counterproductive, since sooner or later they'll
have to be dynamically generated. I was hoping this could be a
preliminary patch, with the main work coming later, but likely we need
to solve region registration by themes before this patch is applied. I
don't have a good idea of how region registration by themes would be
implemented (a hook on theme activation?), and invite suggestions or
implementations.
* Theme system changes
Besides region registration, the other change I'm seeing that would be
needed in the theme system is loading blocks by region name, rather
than region id. This is because the ids currently used ('0' and '1')
in theory might be diffferent on a particular install.
------------------------------------------------------------------------
April 17, 2005 - 17:18 : syscrusher
Instead of having themes "register" their regions, why not just add a
theme API hook called them_regions() that returns an associative array
of $region_name=>t($region_helptext)? This would be in keeping with
other similar API functions, such as those that return what permissions
apply to a module or what node types are defined by a module. Most
themes are going to define only a small number of regions (two being
the typical case now, but I could see five or six in a complex theme),
so returning a constant array will be faster than querying SQL to
obtain an array of rows.
There could be (optionally, at the discretion of whoever builds this
thing) another API hook like theme_region_properties($region_name) that
returns an associative array with detailed info for a given region, such
as extended help text with recommended usage instructions for the
region.
Scott
------------------------------------------------------------------------
April 17, 2005 - 17:19 : syscrusher
s/them_regions/theme_regions/g
------------------------------------------------------------------------
April 17, 2005 - 18:47 : adrian
Because. The most common 'theme' is a phptemplate theme.
And there needs to be a generic method for specifying the regions
available, in a non hook_function format..
Themes get their names from the directory in which they are contained..
when copying the theme to another directory, there must be _no_
modifications necessary to allow normal usage. This is one of the
tenets of the new template system I designed.
You would need a standard way to define meta-information for themes,
that does not need to be modified when copied to a new directory. We
are working on this in the install system work, as you need a way
external of Drupal to define the module dependencies and some other
things.
My approach would be to add a theme.dsc text file to the directory,
which would allow you to specify meta-information. For instance :
----
regions: left, right, footer, center, mountie
author: Johnny McAngstyPants
----
------------------------------------------------------------------------
April 17, 2005 - 22:00 : syscrusher
Adrian wrote:
"
Themes get their names from the directory in which they are contained..
when copying the theme to another directory, there must be _no_
modifications necessary to allow normal usage. This is one of the
tenets of the new template system I designed.
"
A very good point. But region names don't have to be unique across
different themes, so my hook function wouldn't have to be modified. The
suggestion I made for the mapping metadata was three factors: theme ID
or name, region ID or name, and block ID (plus one non-key weight value
to order the blocks within a region, but this is not relevant here).
I'm not familiar enough with PHP template to be able to respond to your
comments on that one, so if you say it's not feasible to work with my
schema, then I'll take your word for it. :-)
Scott
------------------------------------------------------------------------
April 17, 2005 - 22:03 : syscrusher
Oh, wait.....I see now what you mean! It's not the output of the
function that is the problem, but the *name* of the function.
Never mind. I concede your point.
Scott
------------------------------------------------------------------------
April 18, 2005 - 03:44 : Jaza
I'm probably jumping ahead a bit here... but something that this patch
will have to eventually account for, is how to allow regions to be
defined as inline. Allowing a theme to define a region's position as
being anywhere on the edge of the page (i.e. top, left, right, bottom,
corners, etc) is relatively easy. But what about having a region that's
in the middle of a node's body, or somewhere else that's not the edge of
the page?
What I'm thinking of, is eventually allowing the custom region system
to integrate with the CCK. Like I said, I admit that I'm jumping ahead
into the future - the CCK still has a long way to go before it's ready.
But ultimately, it would be cool if a theme could define a region as
being after, say, the "rating" field in nodes of type "movie review".
This would make the region (and the blocks in it) truly inline and in
context with the actual content of the node.
This would be a huge step forward compared to the current block system,
which doesn't allow you to mix the presentation of blocks and nodes at
all. In Drupal ATM, blocks and "the rest of the page" are totally
separate, and really you have no choice but to display them as such.
The result of this is that information in blocks that really should be
displayed as part of a node, gets literally "pushed to the side", and
always seems secondary to the actual content. Often the block has
content that is just as important as the content of the node itself.
Another option (of less merit, IMO - because of the extra maintenance
work, and lack of enforced consistency) would be to have a region
filter. You could then choose where to place an inline region on a
per-node basis, by entering text such as [region:2] (example based on
image_filter syntax) into the node body.
Anyway, just thought I'd throw that idea into the open. I don't expect
it will be implemented any time soon, but it's something to think
about.
Jeremy
------------------------------------------------------------------------
April 18, 2005 - 04:54 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions---possibility-1.png (1.29 KB)
Imo the 'regions' are more than you guys name here.. FOr example I
attached 2 screens which only shows you the regions.. What I think is
that it should always be possible to have free names for the regions.
No matter if i call - the region where my content appears in -
'content' or 'site items'..
See attached screens..
------------------------------------------------------------------------
April 18, 2005 - 04:56 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions---possibility-2.png (1.39 KB)
And the second...
See these links:
- http://drupal.org/files/issues/regions---possibility-1.png
- http://drupal.org/files/issues/regions---possibility-2.png
------------------------------------------------------------------------
April 18, 2005 - 11:22 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions2.patch (13.39 KB)
Here's a revised patch implementing some of the ideas so far. I've used
the theme engine - rather than individual themes - to generate the list
of available regions. I know this isn't ideal, but e.g. for xtemplate
it's at present the only option--no logic is possible in the individual
theme.
region is changed to a varchar field from the current tinyint.
I've roughed in several regions--really just for demo purposes. More
thought and work would be needed to refine them (e.g., styling, etc.).
But this maybe moves the conversation forward.
------------------------------------------------------------------------
April 18, 2005 - 17:26 : Dries
This patch enables different regions to be used. That is a good thing.
The next question is: should we take into account that different themes
could assign blocks to different regions? Lots of problems would be
solved if (i) there could only be one active theme on a website or (ii)
if all themes would have a common set of regions.
(This "let users select their own theme"-thing is a left-over from the
early days, except for WAP stuff maybe.)
------------------------------------------------------------------------
April 18, 2005 - 17:37 : killes(a)www.drop.org
Giving up multiple theme support would be a great thing. People could
still select from multiple style sheets. WAP shoud not be a user
preference setting, but automatically detected and redirected to a
special site with a WAP theme.
------------------------------------------------------------------------
April 18, 2005 - 17:48 : adrian
You would then lose the ability to make a special front page theme for
use with the sections module, for instance.
Also, currently styles exist in the same namespace as themes, and we
would have to make more a distinction of styles vs templates (or
themes), but I do think this could help simplify things.
------------------------------------------------------------------------
April 21, 2005 - 12:54 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions3.patch (15.69 KB)
The main issue raised, if I'm understanding well: if a theme or theme
engine is present that offers regions other than those available in the
default theme, any blocks assigned to those regions will be invisible to
most users.
Here's a revised patch addressing the concern. I've added a test for
each region to see whether it's also available in the current default
theme. (Actually, I'm realizing as I write this, I've used the theme
engine--so it would need to be updated to test first if an engine is
being used.)
In any case, any regions not available by default are starred, and a
message text appears (only if necessary).
If there's support for the approach, I'd be happy to finish the patch.
Remaining work:
* extend to work with non-engine themes
* finalize base set of regions to implement
* implement common region set in all core themes (for now I've only
done xtemplate)
* work on CSS display (how blocks in each region should look)
This last point I'm not too confident on and would look for
help/suggestions.
Screenshot to come.
------------------------------------------------------------------------
April 21, 2005 - 12:56 : nedjo
Attachment: http://drupal.org/files/issues/block_regions_message.png (12.34 KB)
Screenshot showing starring of non-default regions plus message.
------------------------------------------------------------------------
April 21, 2005 - 13:19 : killes(a)www.drop.org
I like that approach. +1
------------------------------------------------------------------------
April 21, 2005 - 13:23 : resmini
My two cents.
If this has to be done (and it should), better get rid of spatial
definitions for areas such as left, right, top, bottom, etc.
Use semantic names related to content and let the theme take care of
their positioning interely.
Also note that there in an ongoing debate in IA trying to build up a
standard naming convention for page regions in a way that is
semantically (and logically) correct. Just for the sake of it, you can
check
http://www.stuffandnonsense.co.uk/archives/whats_in_a_name.html
http://www.stuffandnonsense.co.uk/archives/whats_in_a_name_pt2.html
with follow-ups, including Eric Meyer's. There are more substantial
contributes in the AIfIA web site, but I can't seem to find them now.
I'll post a link or an abstract if I manage to.
--
vector at exea dot it
------------------------------------------------------------------------
April 21, 2005 - 14:15 : nedjo
Good points, useful references. The default regions I'm thinking of
are:
'banner' => t('banner'),
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
'footer' => t('footer')
Perhaps "body" would be better as "content"? It would be easy enough
to add in more regions, e.g., within the content (after title, after
help, etc.) One issue is that many of these regions will already have
rendered content. Should the blocks come before or after that other
content? I've assumed after for banner and footer, while giving both
options in body.
In any case, refinements or suggestions would be great.
------------------------------------------------------------------------
April 21, 2005 - 14:56 : resmini
Well,
'banner' => t('banner'),
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
'footer' => t('footer')
The classic (as far as classic goes for something Web related) scheme
comprises 5 spatial regions, much like stefan's
http://drupal.org/files/issues/regions---possibility-1.png with a left
area mirroring the one called 'blocks'. Call them top, left, center,
right, bottom.
Variants usually exclude one or more of these, layout-wise.
If we talk content (semantic) instead, things get a bit more
complicated, as these spatial regions normally include more than one
content-area. The top, for example, could include ad banners and the
site's header, or the main menu. But these merge seamlessly with CSS
definitions, which are definitely something that should get properly
standardized (most of the errors / inconsistencies I'm encountering
with Drupal today are related to this), but this is out of scope in
this thread.
What I somewhat object to the definitions above is that it mixes the
two approaches.
'banner' is not spatial, is content, as it is the distinction between
body top and bottom. If 'banner' goes there, it is 'top', whatever that
might be. I designed a couple of web sites which had
headers/logos/banners at the bottom of the page, and I'm not exactly
the wildest designer you'll probably meet.
And if we include body_top and _bottom, we should also add
'navigation', or 'menu' and some other content-related semantic region
(impressum, or company_data, or whatever).
I suggest that either we go along
'top' => t('banner'),
'left' => t('left sidebar'),
'center' => t('body'),
'right' => t('right sidebar'),
'bottom' => t('footer')
or we dedicate some time to detailing what could possibly fit there
semantically, which is perfectly possible without limiting design
freedom or whatever, since the vocabulary is not infinite, but not
something you do out of the blue.
Please note that I understand t('something') to be an example, since
such a layout only defines regions on the page, not semantic regions.
My main content could fit nicely in the bottom region.
As for the names for the regions, they are not important, as much as
they are coherent and enforced.
------------------------------------------------------------------------
April 21, 2005 - 17:16 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions-final.png (2.39 KB)
Maybe something like this???
But, I have to say that I _really_ liked the solution to split the
'content'-region into the 'content' and 'beneath content'.. I love
that!
------------------------------------------------------------------------
April 21, 2005 - 18:20 : resmini
Stefan, yes.
That's basically what you can build if you stick with spatial, and this
layout can generate quite an amount of (sane) layout variations even if
you interpret it strictly (suppose a default) as
<div id="header">
</div>
<div id="left-bar">
</div>
<div id="content">
</div>
<div id="right-bar">
</div>
<div id="footer">
</div>
What you can do with this is left basically to the theme designers and
their use of CSS, CSS-P or tables (brrr), but this could be an easy and
proper way to identify macro-regions in which more accurate positioning
happens at a more specific level.
I'm all in favour of subsequent identification of sub-areas (top and
bottom in body), but I don't think it would be a good idea to mix the
different approaches I mentioned in my previous post.
A site with lots of things going on or which is not just blogging
surely has the need to use its content area in a wiser manner than just
putting there 'content', the number of modules doing precisely this is
more than proof, but that falls more in a 'Drupal definitive guide to
semantics', in which CSS selectors are used or suggested strategically
for such a scope.
>From this point of view and for the sake of this thread, any unique
area / div (#name) could (should?) be a target for blocks, and this in
my opinion (*) would be the perfect solution, but I do not know if and
how this is even remotely possible in the current Drupal.
(*) It's quite late, local time, and it was a looong working day.
------------------------------------------------------------------------
April 21, 2005 - 18:38 : resmini
Attachment: http://drupal.org/files/issues/regions-final-variation.png (1.9 KB)
Just to be clear, I add a variation of stefan's scheme that shows how
this is *not* by any means positional, but spatial, or better
relational. Use your CSS imagination to take out regions, reduce them
to empty containers, enlarge them, make them taller, shorter, whatever.
5 regions, do what you like.
------------------------------------------------------------------------
April 21, 2005 - 18:44 : resmini
Sorry, I forgot.
And this is also why I'm not too keen on calling anything 'content'. If
I enlarge my right region enough, why not put my content there?
Shouldn't this be a theme-level concern?
It's nothing serious, but if my center area is called 'center' (or
something similar and more sexy), I won't confuse anybody.
This is left, center, right: do with them what you prefer. Content in
the bottom? Show me.
If I call something 'content', I'm more than suggesting that content
goes there, and only there.
------------------------------------------------------------------------
April 22, 2005 - 04:17 : stefan nagtegaal
Resmini, maybe it is only me but I think that you are making a mistake
in your way of thinking..
I get the feeling that you're mixing the 'regions' and 'divs'.. the
'regioins' should have meaningfull sentences, but the divs
shouldn'thave..
As an example:
$region_name => $content_body
here we go:
'header' => $logo
'left sidebar' => theme('blocks', 'left')
'right sidebar' => theme('blocks', 'right')
'content' => $content
'footer' => $footer.
So, $region_name does not have to be equal to the id or class of the
divs..
------------------------------------------------------------------------
April 22, 2005 - 05:27 : resmini
Stefan,
>So, $region_name does not have to be equal to the id or class of the
divs..
Yes, absolutely. I probably didn't make myself very clear: what I'm
trying to point out is that in
'header' => $logo
'left sidebar' => theme('blocks', 'left')
'right sidebar' => theme('blocks', 'right')
'content' => $content
'footer' => $footer.
there is no reason at all to call 'content' the region that holds
$content.
nedjo asked in #24
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
if /Perhaps "body" would be better as "content"?/ and all my reasoning
is simply that no, that is not content, or it shouldn't be (or better:
it may happen that main content is elsewhere). As a matter of fact,
even the connotation 'sidebar' doesn't fit very well logically.
To make it short: Today's method works, but has limits. Mambo, which
paragkenia quotes at the beginning, handles more 'user regions' but in
pure Mambo style conventions are so loose that they are hardly useful.
If we define regions, as in nedjo's example, in my opinion these
regions shouldn't imply informational layouting, only relational
positioning (that is, where they stay in the browser viewport).
I know it may look like overdesigning, but Drupal constantly enforces
conventions and coding guidelines everywhere: this is one of the best
aspects of the project and I think it should carry to the layout.
------------------------------------------------------------------------
April 22, 2005 - 05:32 : stefan nagtegaal
While I think that 'body_*' is not as self explaining as 'content_*' I
vote for using 'content_*'..
------------------------------------------------------------------------
April 25, 2005 - 13:48 : chx
Let's get back to the code. If my understanding is correct the big
discussion is about how to name potiental rectangular areas _after_
this is commited. So, first get this committed. What's need to make
that happen?
------------------------------------------------------------------------
April 25, 2005 - 14:56 : chx
I spoke with Moshe, Steven, JonBob and the result is: keys shall be
numbers, and themes shall define the values. We will make region zero
and one required. There will be a define('REGION_CONTENT', 0) and a
define('REGION_SIDEBAR', 1); so you can have readable code still.
Either wait for me to code it or feel to do it yourself, just drop me a
mail via the contact form if you are doing it.
------------------------------------------------------------------------
April 27, 2005 - 12:14 : nedjo
Károly, it's great if you're willing to take on finishing this. I
tried to summarize remaining work in update 20, above [4].
The numerical keys look fine to me.
In terms of an initial default set of regions, one quirk is this: for
now, so far as I can see (and assuming the approach I sketched in),
available regions can be defined only in (a) theme engines and (b)
individual themes that don't use an engine. So, for instance, an
individual xtemplate based theme can't define its own custom regions;
they need to be defined in the theme engine. (Unless and until the
whole theme system should switch to the sort of configuration file
adrian suggested above [5].)
Which is to say that, under this approach, we'll be defining a set of
regions for each engine, and then all themes using that engine should
try to implement those regions. (Otherwise, if a site admin selects a
region defined in the engine but not implemented in the default theme,
the content won't appear.)
Please let me know if there's anything in what I've done that isn't
clear, or if you want to pass some or all of this back.
Thanks!
[4] http://www.drupal.org/node/16216#comment-27398
[5] http://www.drupal.org/node/16216#comment-27052
------------------------------------------------------------------------
May 9, 2005 - 16:36 : chx
I had a "short" discussion with the UI team leader ie. Ber Kessels. The
outcoming is that we will change hook_block so that it uses callbacks a
bit like menu system. Here's an example:
<?php
function module_block() {
$items = array();
$items['module_header'] = array('callback' => 'mymodule_page',
'weight' => -50, 'region' => 'content' , 'cache' => TRUE, 'pages' =>
"node/*\n<front>");
return $items;
}
?>
Please note that we are allowing caching the themed output of each
block independently.
The theme system will execute hook_block as it does now and it'll
execute the callbacks defined in module_block as well. Of course if the
callback is cacheable and in the cache, it'll print it from cache. If
it's themeable and not in the cache, it'll cache it before printing.
Pages contains a string (could be PHP code!) which can be overriden in
the block configuration screen.
Callbacks defined in hook_menu will have lot less functionality after
this, they will be used for non-themed pages mainly.
------------------------------------------------------------------------
May 9, 2005 - 16:45 : chx
More explanation is requested for the example.
module_header is the unqiue name of the block.
pages define on which pages the block is visible. ('pages' in the block
configuration screen.) Maybe I'll implement 'visibility' from the same
screen as well.
callback, weight are well known Drupal terms.
cache is a boolean which defines whether given output is cacheable or
not.
------------------------------------------------------------------------
May 9, 2005 - 16:47 : chx
Ber, Dries, do not kill me! Ber chaired the usability meeting in
Antwerp, that's all.
------------------------------------------------------------------------
May 9, 2005 - 16:52 : Bèr Kessels
Attachment: http://drupal.org/files/issues/more_regions_principle.png (123.29 KB)
attached is a schematic which might clarify this a little.
And I would also like to comment on me being the UI leader: I do not
consider myself any leader, no ofeence, though. Just to clarify that.
------------------------------------------------------------------------
May 9, 2005 - 18:42 : nedjo
I am not opposed to the idea of changing the _block() hook to use
callbacks (I have no opinion on it, not immediately grasping the need),
but this seems quite distinct from the aim of enabling multiple and
extensible regions. Why can't we just move ahead with the block
generalization?
I suggest:
* quickly implement the proposed block region generalization, using
only the two existing regions (i.e., implementing them in core themes)
* later worry about:
- adding further regions (the details of which are best done by those
primarily responsible for the particular themes)
- possible changes to the _block() hook.
Wouldn't this make sense? Or am I missing some pressing reason for
which the block generalization has to wait?
------------------------------------------------------------------------
May 9, 2005 - 21:28 : killes(a)www.drop.org
"Or am I missing some pressing reason for which the block generalization
has to wait?"
I might be missing something too, but I thought Chx was just talking
about the block generalization and proposing a way to code it.
------------------------------------------------------------------------
May 9, 2005 - 22:41 : factoryjoe
I wanted to chime in with this discussion because it's an important one
and has some really huge implications for Drupal moving forward. That
said, I also have a day job pulling all my attention which means that
the big ideas I have for this problem can't be put into a complete
visual form for at least a week or more. In the meantime, I'd like to
offer a few thoughts on the matter.
* *Regions do not belong in themes.* Blocks were originally separate
from themes for a reason. Themes should define the general look and
feel of a site -- and to some extent a site's behavior. Layouts which
define the spatial relationship between regions belong in some
intermediary between style and content, which does not currently exist
in Drupal.
* I would propose that *layouts become a new kind of CCK tool.* By that
I mean that they can be defined, shared and deployed very easily -- even
as simply as tossing a directory of some .layout textfiles into a
layouts/ directory. Note that this suggestion has nothing to do with
the way CCK /might actually/ work right now; instead I'm suggesting how
I would like it to work. I would like, for example, to create a CCK item
like a "person" and ship it with a .layout file that carries all the
semantic goodness needed to output that "person" to the screen in
juicy, semantic markup... which anyone can come along and theme to
their heart's content.
* *Creating shareable layouts should be relatively painless.* Dashboard
[6] sets the bar for easy hackability. It should be that easy to create
layouts for Drupal... I can imagine creating an "iTunes layout" or an
"Image Gallery" layout and so on... If we used something akin to PHPTal
to develop the layouts, we could keep development fairly standard while
making it possible for more folks to hack up cool and innovative
layouts.
* *Layouts should be extensible.. to a degree.* I see a huge problem
with how this discussion has floated back and forth between semantic
and spatial region naming. Because we talk about this problem in those
terms, we fail to identify the real problem and opportunities presented
to us. Here's the thing: when you predefine regions, you limit
creativity and the ability of people to really use the system. On the
other hand, when you make a system too flexibile, it quickly becomes
unwieldy. In all the mockups presented above, both classes of problems
would arise. Therefore we need to think about a way to stay flexibile
while "taming the beast."
* To that end, I suggest developing *self-contained layouts that are
contextually-complete.* So for the example of the iTunes search
layout... you would know before hand that you get a couple multiple
select boxes that you can hook up to whatever taxonomies you want to
progressively filter [nodes]. You could even change the .layout file,
allowing you to theme it to your liking -- even though that would
totally optional, given the layout's internal default styling. Once
you've got your layout, you would go into a layout module UI [7],
create a new layout [8], select the layout from a list [9] and then
give it a path so you can access the layout... You would then walk
through a wizard [10] that would help you populate that layout with all
kinds of nice Drupally goodies... feeds, node listings, PHP code, etc.
The power in this approach is multifold. For one, it snaps Drupal out
of its block mentality and allows designers to really innovate with
individual page designs. In fact, I've already thought out how I could
reimplement Flickr using this system, combined with Drupal's native
feeds, taxonomy and menu module, and I'd barely break a sweat... sort
of. ;)
But anyway, this is a very productive conversation to be having, but I
really think that we should consider whether the old paradigm, as such,
really pushes Drupal as far forward as we have the opportunity to go.
[6] http://drupal.org/apple.com/macosx/theater/dashboard.html
[7] http://photos4.flickr.com/6944826_90af237c99_o.png
[8] http://www.factorycity.net/demos/civicspace/layout/new.html
[9] http://www.factorycity.net/demos/civicspace/layout/new_layout.html
[10]
http://www.factorycity.net/demos/civicspace/layout/testing_add.html
------------------------------------------------------------------------
May 10, 2005 - 00:34 : chx
While factoryjoe may be right, I could be right as well.
Regions has definitely something to do with themes, after all it's the
theme that renders the page, and it can only render regions that it
knows of.
So, instead of postponing this into the far future when someone comes
out with a layout system, I code this now.
------------------------------------------------------------------------
May 10, 2005 - 01:22 : Dries
The proposed 'weight', 'region' and 'pages' would be configurable, not?
Are these just defaults? The 'callback' and 'cache' options are nice to
have.
------------------------------------------------------------------------
May 10, 2005 - 01:25 : chx
Yes, blocks can provide a default for everything on the block and and
configuration screen. Of course, you can override these in the UI.
------------------------------------------------------------------------
May 10, 2005 - 05:02 : Bèr Kessels
Dries: yes, the region, weight and pages will be configurable from an
admin interface. What we tried to address here, is a method for
developers to choose good defaults. Take for example "logo". that
should be enabled by default in a regions called header, rendered on
all pages, and have a very light weight. We should not force an admin
to visit the blocks admin before she can see or use the logo.
Chris: I do not know if you have ever tried typo3. Its concept is some
form of builder system. I do not like thar, because far too complex. If
we ever get sme kind of builder in core (if ever) it will require a lot
of work, and even more usability research. So for now such a builder is
far out of our reach. Lets aim at goals that are more realistic ;) So:
it does belong in themes, its the best place that is still realistic.
I do like your visions, Chris, but I hope you agree they are not
realistic, yet. So, maybe you can think of a path towards your visions,
ow we can reach such a builder-system, you describe?
------------------------------------------------------------------------
May 10, 2005 - 10:52 : factoryjoe
My browser crashed before I was able to submit my followup to chx's
comment... I have no problem with the current work going forward and am
happy to see it happening. I know that my ideas are typically
outlandlish and far off... That's the kind of design I enjoy doing!
In any case, I see chx's solution being a means to an end; once we have
abstracted the region code, it become much easier for me to get some
help creating my vision.
In the meantime, and as a demonstration of how I see this layout system
working (to answer, I hope, Ber's concerns about clunkiness), I've
created a workflow movie that shows off how fast you'd be able to add
content to the system.
Check it out:
http://factorycity.net/demos/civicspace/layout/media/layout_workflow_v1.mov
Feedback appreciated. And, if you want to try the demo out yourself
(it's all hardcoded, like a "movie set" for my UI), go here:
http://factorycity.net/demos/civicspace/layout/
------------------------------------------------------------------------
May 12, 2005 - 12:45 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions4.patch (13.56 KB)
"I might be missing something too, but I thought Chx was just talking
about the block generalization and proposing a way to code it.
"
Well, if I can say so respectfully, I don't think so. Not so far as I
can see identifying problems with my original patch, this interesting
discussion is rather addressing the (useful, but logically subsequent)
question "once we have multiple regions, how should we work with
them?". It's perhaps demonstrating our propensity to try to do more
rather than less with a given patch--to talk for a long time when a
first step solution is already in place. So here is a (yes, interim!)
small, focused, and tested patch to remove the hard-coded regions.
I've stripped it down so it does nothing more than (a) make block
regions declared by themes rather than hard-coded and (b) implement the
existing left and right regions in existing core themes. Please, try it
out, I think you'll like it. I'm of the (I'm hoping not scandalous)
opinion that it can be applied right away, and so clear the way for
further progress. In particular, this patch leaves the adding and
configuring of additional regions to theme authors/maintainers, who are
best qualified for the work.
"I spoke with Moshe, Steven, JonBob and the result is: keys shall be
numbers, and themes shall define the values. We will make region zero
and one required.
"
The reason I moved from numbers to strings (e.g., "left") is that a
theme author defining regions has no way of knowing what regions might
have already been defined, and therefore what integers might have
aleady been used. It's like module and theme names--we'd have to use
random numbers to avoid conflicts, so we're better off with string
names.
------------------------------------------------------------------------
May 12, 2005 - 14:17 : Bèr Kessels
nedjo,
I am not a fan of your solution for blocks that dissapear. It breaks
the ability to allow more themes on a site. if important blocks dont
show up, your site will simply break. I would rather suggest that every
theme MUST have a region called 'default'. any blocks that want to go
into a non-existing region, will be placed there.
We must define a standard listy of suggested region names. to avoid a
wildgrowth of names.
I am not sure if i like the way you do function phptemplate_regions().
these regions should be defined in the templqtes, not the engine.
Otherwise all phptemplate themes will still all have two regions.
Note that i did not test your patch thouroughly, just applied and
looked at.
------------------------------------------------------------------------
May 12, 2005 - 15:38 : nedjo
Thanks for your comments. I think we're getting somewhere.
"I am not a fan of your solution for blocks that dissapear. It breaks
the ability to allow more themes on a site. if important blocks dont
show up, your site will simply break. I would rather suggest that every
theme MUST have a region called 'default'. any blocks that want to go
into a non-existing region, will be placed there.
"
Good suggestion. Having a default region for blocks to show up sounds
like a valuable backup. I'm thinking we might want to have a way to
designate a given region as the default, rather than having to have one
named 'default'. Thoughts?
"We must define a standard listy of suggested region names. to avoid a
wildgrowth of names.
"
Sure. But the patch doesn't prevent doing that--it enables it.
"I am not sure if i like the way you do function phptemplate_regions().
these regions should be defined in the templqtes, not the engine.
Otherwise all phptemplate themes will still all have two regions.
"
Oh, I wholeheartedly agree, and I've noted the issue above. But unless
we substantially rewrite the engines, some region definition is needed
in the engines, as they call blocks. Should we therefore define a base
set in the engine, then call a hook from the engine to add any other
regions from themes based on that engine? If so, where in the theme's
files should such a hook be located?
And a side note. Do let's make an effort to keep our comments
friendly. Taking the time to note one or two things that do work or
are done well as part of a review is I believe a valuable habit. It
helps to confirm what is indeed accomplished. Beyond this, it helps to
maintain the idea that we are collaborating on shared goals, rather than
pushing individual and competing visions, and that contributions and
work are appreciated, rather than being invitations to criticism.
Thanks, Nedjo
------------------------------------------------------------------------
May 12, 2005 - 15:42 : chx
I am implementing http://drupal.org/node/16216#comment-29282 but it
takes time. regions again have names. default and sidebar regions are
mandatory.
This has little to do with nedjo's code much more with his idea -- I
looked at the screenshot and said, OK this is great but... we'd like to
have a lot more 'blocks' if this comes through, henceforth the above
mentioned solution.
------------------------------------------------------------------------
May 12, 2005 - 16:39 : nedjo
Okay, thanks for the clarification, I hadn't understood that you were
taking a new approach rather than building on what I'd begun. Given
that that's the case, staging as I'd suggested obviously won't work so
I'm content to wait and see what you accomplish. I'd only suggest,
don't feel like you need necessarily to do everything all at once.
------------------------------------------------------------------------
May 13, 2005 - 04:34 : Bèr Kessels
Nedjo, sorry if the sound of my comment was hostile. it was never meant
to be that way. I am busy, and thus did not want to comment all the
things i liked about your patch, but chose to pick the much smaller
amount of things I thought could use some improvement. I will try to
keep in mind to be more friendly next times. Also, not all of us are as
fluent in English as our native English speakers. I think its good to
keep in mind that for a lot of us, communication in English is not as
easy as it may seem. For me, it often requires a lot of concentration
to get the subtleties right. I mean: I can type some English text, look
up words in the dictionary, but to get small yet important subtleties in
my texts is very hard, often.
But, that all said: I liked your patch.
------------------------------------------------------------------------
June 10, 2005 - 07:08 : jakeg
How far off is this from being officially released or at least usable?
If its usable now, what files will I need to implement it?
------------------------------------------------------------------------
June 10, 2005 - 08:19 : Kobus
Attachment: http://drupal.org/files/issues/regions---possibility-3.png (2.21 KB)
To add to Stefan's suggestions with the two screenshots, I modified one
of them a bit, and this is how I understand Jaza's post, and yes, I
agree, this would be a wonderful feature! I can't wait! Imagine how
good it would look if I had a theme that has a clear white background
(not visible blocks) and then these seemingly random boxes on the page,
as shown in the screenshot. Especially where I can place it anywhere
around the node like Jaza said with a [region:2] block etc.
I say again: I can't wait!
Kobus
------------------------------------------------------------------------
June 10, 2005 - 09:59 : chx
I need 3-4 hrs of peace to implement the callback based thing. That's a
lot these days. Let's hope I'll get on it in the following days.
------------------------------------------------------------------------
June 18, 2005 - 18:32 : chx
Here's an example again of how hook_block will look like:
<?php
function module_block() {
$items = array();
$items['module_header'] = array('callback' =>
'mymodule_function', 'callback arguments' => arg(1), 'weight' => -50,
'region' => 'content', 'cache' => TRUE, ''pages' => "node/*\n<front>");
return $items;
}
?>
Items are keyed by unique IDs. The template system will call
module_invoke_all('block'), put the rendered HTML of the blocks into
regions sorted by weight. The rendered HTML is cached if it is allowed.
More keys will be introduced later, but now basically we just throw
everything from block configure in here, and add callback, callback
arguments, region.
Node teasers or fullly rendered nodes are blocks, too. Almost
everything is. So, here what happens when we are on taxonomy/term/1:
taxonomy_render_nodes is called
it calls block_set('node_view', $weight, $node, $teaser, $page); a few
times, so a few node_view blocks will be on the page
later the theme system is invoked. It will ask the block system to
collect all blocks, dynamic and the static blocks as well. For all
dynamic blocks we have a block defined in hook_block somewhere, like
the definition above, with one exception: it will have a 'standalone'
=> FALSE pair, so it is not a standalone block which is automatically
rendered but something that needs to explicitely requested. Also, we
may define a 'suffix' => 'somefunction' pair which provides us with a
cache ID suffix. Look at the code below:
<?php
function block_collect_blocks() {
// get all block definitions
$static_blocks = module_invoke_all('block');
// iterate of the dynamic blocks set on the page
foreach (block_get() as $dynamic_block) {
// get the block definition for the given dynamic block
$static_block = $static_blocks[$dynamic_block['block']];
// merge the callback arguments from the dynamic and static.
dynamic_block['callback arguments'] is always set though
// may be empty
if (isset($static_block['callback arguments'])) {
$dynamic_block['callback arguments'] =
array_merge($static_block['arguments'], $dynamic_block['callback
arguments']);
}
// try to get a cache ID suffix
$suffix = function_exists($static_block['suffix']) &&
call_user_func_array($static_block['suffix'], $dynamic_block['callback
arguments']);
// if the block is cacheable or the suffix function says that
it is cacheable by setting a suffix
if ($static_block['cache'] || $suffix) {
// set cache ID
$cid = 'block:'. $dynamic_block['block'] .':'. $suffix;
// try to get the rendered HTML from cache
if ($block_rendered = cache_get($cid)) {
$return[$static_block['region'][$dynamic_block['weight']][]
= $static_block_rendered;
continue;
}
}
// render the block
$block_rendered =
call_user_func_array($static_block['callback'],
$dynamic_block['callback arguments']);
// store the block for return
$return[$static_block['region'][$dynamic_block['weight']][] =
$static_block_rendered;
if ($static_block['cache'] || $suffix) {
// if cacheable, do it
cache_set($cid, $static_block_rendered);
}
}
foreach ($static_blocks as $key => $static_block) {
// is this a stand alone block, like in Drupal 4.6?
if ($static_block['standalone']) {
// now, the above is repeated, save that we do not have a
dynamic_block here
$suffix = function_exists($static_block['suffix']) &&
call_user_func_array($static_block['suffix'], $static_block['callback
arguments']);
if ($static_block['cache'] || $suffix) {
$cid = "block:$key:$suffix";
if ($block_rendered = cache_get($cid)) {
$return[$static_block['region'][$static_block['weight']][]
= $static_block_rendered;
continue;
}
}
$block_rendered =
call_user_func_array($static_block['callback'], $static_block['callback
arguments']);
$return[$static_block['region']][$static_block['weight']][]
= $static_block_rendered;
if ($static_block['cache'] || $suffix) {
cache_set($cid, $static_block_rendered);
}
}
}
}
function block_set() {
static $blocks;
$args = func_get_args();
if (count($args)) {
$callback = array_shift($args);
$weight = array_shift($args);
$blocks[] = array('block' => $function, 'weight' => $weight,
'callback arguments' => $args);
}
return $blocks;
}
function block_get() {
return block_set();
}
?>
When to expire the block cache? Never. If functions can call
cache_clear all, they can be smart enough to cache_clear only those
blocks that are changed by them. Some blocks won't be cacheable
anyways, say there is little use in caching 'active forum topics'
------------------------------------------------------------------------
June 19, 2005 - 03:15 : Dries
Frankly, I don't understand what you are trying to say. What is a
'dynamic', a 'static' and a 'standalone block'? What is the suffix
for? What is the advantage of making node and taxonomy views blocks?
If there is no big advantage, this is just bloat. All in all, it looks
pretty complex to me.
If we make Drupal more flexible _and_ more complex, people will get
upset, and we end up being like Plone. Drupal's simplicity is
something to foster, as it allows people to go in, and change stuff.
The focus is to make Drupal simpler _and_ more flexible.
I merely spent 10 minutes looking at this (reading your explanation
twice, staring at the code), and the newly added complexity simply
turns me off. Maybe that is because I don't understand what we are
gaining.
------------------------------------------------------------------------
June 19, 2005 - 03:34 : Bèr Kessels
* The first thing we gain, is, very slmple: more regions.
But, how many? what regions? on what pages? in what location? bearing
which name? For all these issues we need some callback system. To allow
themers, administrators and module developers to give answers to all
these questions. what we have now: sidebars, with only admin settings,
is simply too limited: It takes serious hacking (~15 lines of code in
your theme) to get a login block in your header!
* The second thing we get for free: We are passing along chuncks of
HTML, so why not cache them in a central place.
Practice points out that our current cache is not used well. We leave
it to developers to cache. And developers are lazy by nature. Just
looks at all the places where caching should have been done, but is
not. 9/10contribs have at least one of these places.
You must actually see these issues separate. The new central blocks
pulling system, and the caching. the latter is something that we get
for free, a high level of advanced caching (how often has not been put
forward Drupal seiously lacks better/advanced caching?). But we get it
only for free if it is co-developed with the new regions blocks.
And Last but not least, everything is a block, from a themer point of
veiw. I know developers tend to think: I do the content, and do not
care about where and how it turns up. That results in a content-centric
system, what we have now. Everythng is built around aa single chunk of
content. while, in fact content, is yet another block. Look at
http://www.terminus1525.ca/index.php?l=en or
http://www.franklinpennsylvania.us/ as it stands now, its up to the
developer to concenate all the HTML in the center area, into a huge
chunk of HTML. While in fact everyone can see that these are a lot of
separate blocks.
------------------------------------------------------------------------
June 19, 2005 - 03:39 : Dries
Ber: I was talking about chx's latest changes, not the block system in
general.
------------------------------------------------------------------------
June 20, 2005 - 14:06 : nedjo
I appreciate the update on directions being contemplated, although I
find it confusing.
Again, I'd caution, let's keep focused on the aim at hand, and on a
staged solution. A bigger patch means greater complexity, more
difficulty getting meaningful review, and greater delays in getting a
priority change. We're currently in a position where we have two
hard-coded regions for blocks, a major issue if nothing else than
because it reflects poorly on Drupal's usability and versatility.
Moving from here directly to something like "everything you see
anywhere is a (nested) block in its own (nested) region" strikes me as
a bigger step than we need to take.
And in belated reply to Ber's note (#53 above [11]), thanks for the
thoughtful comments, I didn't mean to single you out and acknowledge
that language & cultural differences play a role, I feel we can all
benefit from attention to communication.
[11] http://www.drupal.org/node/16216#comment-29633
------------------------------------------------------------------------
June 21, 2005 - 15:39 : Dries
Even with the explanation in chx's sandbox, this is too complex for my
likings. Here is a suggestion: let's drop the caching and the
'suffix'-stuff. Let's also drop the 'complete' and 'incomplete' stuff.
Keep it _simple_, chx. IMO, you're creating a monster.
------------------------------------------------------------------------
June 22, 2005 - 16:47 : chx
nedjo, take over. I am out.
------------------------------------------------------------------------
June 22, 2005 - 18:51 : djnz
Quick and dirty solution? Let blocks be assignable to 9 locations - Top
left, middle, right, middle left, middle right, bottom left, middle,
right.
The actual location of these areas within a theme is up to a theme
designer, but the designer should include each of them - how about
$sidebar['tl'], $sidebar['tm'], $sidebar['tr'] ...
Backwards theme compatibility could easily be maintained by only
creating the $sidebar array if the theme has set (eg in its
template.php file for a PHPtemplate theme) a flag, otherwise generate
$sidebar_left from the blocks set (in sequence) to top left, middle
left, bottom left, top middle and middle middle (arbitrary break) with
$sidebar_right the remainder.
I appreciate I have no karma here and only superficial knowledge of the
Drupal code, but sometimes the clarity of a view unclouded by too much
information is useful ;)
------------------------------------------------------------------------
June 27, 2005 - 02:26 : nedjo
Attachment: http://drupal.org/files/issues/regioning.patch (24.74 KB)
"
nedjo, take over. I am out.
"
Um, okay. I've given the question some more thought and come to the
following conclusions:
1. If we take regions to be areas of the page that specific types of
content are rendered into, and a regioning system to be a system to
accomplish this, we already have a number of regions and different
types of regioning systems. They include:
(a) our current blocks system, and
(b) the various drupal_set_[region]() functions, like
drupal_set_comment().
(c) specialized hooks like our help system, which assembles content to
be rendered into a region.
2. LIkely we should tease out regions from blocks.
So attached is a next rough cut at regioning. Features:
* Default region is defined in general admin settings page
* Regions are defined in both engines and themes. A particular
engine-based theme has the regions it defines plus the engine's default
ones.
* Content can be written to regions in two ways: through blocks or
through drupal_set_content($region, $content) calls.
Initial comments are welcome. I'll work on getting a more polished
patch and also more explanation of the approach.
------------------------------------------------------------------------
June 27, 2005 - 02:43 : deekayen
Disclaimer: I offer no code for this, so this is just a bunch of
idealism I can't back up.
djnz's comment makes sense if you want quick and dirty, but it seems to
me the correct way to do things would be in terms of relatives. I would
think doing it right the first time would be easier than redoing block
location code twice. For example set a standard starting location;
perhaps the start is 100% height/width conceptually. If you want to put
something on the right, it would be the first block on the right of the
starting block - let the theme manage widths. Then if you want another
block on the right, or 10, just keep adding them relative to the others
kind of like the current ordering of book pages or like adding more TD
cells in a HTML table.
Using this example under the current standard layout, the main block
could be in the middle with with relative blocks on the left and right.
------------------------------------------------------------------------
June 28, 2005 - 06:26 : arnabdotorg
It would be totally awesome to see multiple regions in Drupal 5, if not
4.7.
This topic has been discussed several times before, noting them down
for reference:
http://drupal.org/node/2790 /[September 9th 2003]/
http://drupal.org/node/10653
http://drupal.org/node/13008
I also think it would be nice to have people implement multi-region
themes; see what problems we encounter, and learn from it.
------------------------------------------------------------------------
June 28, 2005 - 08:28 : arnabdotorg
Forgot to add, I've patched nedjo's final patch [12] to Drupal HEAD,
it's up at http://arnab.drupaldevs.org/ [13].
[12] http://drupal.org/files/issues/regioning.patch
[13] http://drupal.org/files/issues/regioning.patch
1
0
Issue status update for http://drupal.org/node/25928
Project: Drupal
Version: cvs
Component: base system
Category: bug reports
Priority: minor
Assigned to: Uwe Hermann
Reported by: Uwe Hermann
Updated by: Uwe Hermann
Status: patch
Attachment: http://drupal.org/files/issues/thethe.patch (1.39 KB)
Some "the the" typos in two files. Patch attached.
Uwe.
Uwe Hermann
1
0
Hi there,
I have been working on node aggregator (now named naggregator, because of the
16 char limit in the type-col of node table ;) ).
But i have some problems / concerns about images. As it stands now, we can
receive two kinds of files: embedded images, and enclosed files (podcasts). I
will not yet work on the latter. The first has my concern.
Now, img tags will be simply re-posted in the aggregated item, thus "stealing"
images from the originating host.
I want to know what you people say about this behaviour. Should it the image:
a) remain deeplinked, thus stealing it (Its up to the feed-provider to strip
image tags if she does not want them deeplinked, after all)
b) strip the image tags. thus maybe taking the feed out of its context.
c) fopen() and copy the file into our own file-sytem, then rewriting the url
of the image to the one we now server local.
Regards,
Bèr
--
[ Bèr Kessels | Drupal services www.webschuur.com ]
2
4
[drupal-devel] [feature] Enable multiple block regions (not just "left" and "right" sidebars)
by arnabdotorg 28 Jun '05
by arnabdotorg 28 Jun '05
28 Jun '05
Issue status update for http://drupal.org/node/16216
Project: Drupal
Version: cvs
Component: block.module
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: paragkenia
Updated by: arnabdotorg
Status: patch
Forgot to add, I've patched nedjo's final patch [1] to Drupal HEAD, it's
up at http://arnab.drupaldevs.org/ [2].
[1] http://drupal.org/files/issues/regioning.patch
[2] http://drupal.org/files/issues/regioning.patch
arnabdotorg
Previous comments:
------------------------------------------------------------------------
January 26, 2005 - 10:27 : paragkenia
I read the comparision discussion between *Drupal* and *Mambo*. In
several messages it was outlined that Drupal can place blocks only in
right and left and not flexible to put them on anywhere where one want.
It will be great if this can be changed in upcoming versions.
I am no pro at PHP, so don't know how much time this task will take,
but I think it is very important.
parag
------------------------------------------------------------------------
April 15, 2005 - 01:44 : nedjo
This issue was apparently partially addressed in issue
http://drupal.org/node/19694 [3].
[3] http://drupal.org/node/19694
------------------------------------------------------------------------
April 17, 2005 - 00:24 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions.patch (8.17 KB)
This much-requested functionality - to have the ability to place blocks
in more than the two predefined regions - was partially addressed in
issue http://drupal.org/node/19694. [4]. But "blocks" are still
limited to the "left" and "right" sidebars (hard-coded in
block.module).
This patch is a first step designed to enable multiple (eventually,
admin-definable) regions for blocks. I've moved the existing "left"
and "right" block regions to a 'region' table (with ids of 0 and 1, as
currently used in themes). Then all references to the regions are
drawn dynamically from the table. This way, if further records are
added, they will appear in the list of available regions for block
placement.
Doing this actually reduces some duplicated code, since it's no longer
necessary to repeat code blocks for each of "left" and "right".
As it stands, the patch doesn't add any new functionality--but I don't
think it breaks anything either. New functionality would need (a) new
regions defined, and (b) changes to themes. A simple first step might
be, e.g., to add a "footer" region and then add a call in the footer
generation to append any blocks assigned to the footer region there.
I'm setting this to patch, but I'm aware that it needs some discussion
and refining before it'll be ready to apply.
[4] http://drupal.org/node/19694.
------------------------------------------------------------------------
April 17, 2005 - 01:05 : nedjo
Attachment: http://drupal.org/files/issues/block_regions.png (5.65 KB)
Here's a screenshot showing the block admin page, with drop-downs for
region placement (the options are dynamically generated based on
defined regions).
------------------------------------------------------------------------
April 17, 2005 - 02:57 : adrian
The biggest problem with this is that you can have multiple themes, and
each of these themes can have different regions available.
Also, the method of defining which regions are available needs to be
standardised. Some of the work that me and Vlado are working on for the
install system would go towards solving that problem (ie: meta
information for modules, themes and styles).
This has been discussed to death, but the general consensus has been
that we _want_ to do this, but we need to solve a few other problems
properly first, the most pertinent being the interface issue. Chris
(factoryjoe) recently did a whole mess of workflows for something
related to this.
------------------------------------------------------------------------
April 17, 2005 - 04:09 : syscrusher
The first paragraph of adrian [5]'s post is a point that occurred to me
also, as I read this thread.
One suggestion would be to separate the definition and configuration of
blocks, on one hand, from the placement of those blocks, on the other
hand.
In other words, Drupal core provides a mechanism defining what blocks
exist, which of these are on by default or off by default and
user-selectable vs. which are forced on for all users, and the
configuration (if applicable) of specialized blocks defined by
particular modules.
Each theme provides a standard hook function that returns an array of
region names and help/description text, e.g., array('left'=>t('This
vertical region is left of the main content area'), 'right'=>t('This
vertical region is right of the main content area'), 'footer'=>t('The
footer is below the left, right, and main content areas of the page')).
The theme part of Drupal core (i.e., theme.module itself, not the
individual themes) provides a standard UI that is displayed within
config of *each theme* (but is one physical code base within
theme.module) that allows the administrator to map blocks defined by
Drupal core into regions defined by the theme, and storing that mapping
as an theme-to-block_ID-to-region_ID (with weight) table in the
database. From there, the actual page rendering is similar to what's
being done now, but there is more of it.
I guess what I'm trying to say is that the key to solving this problem
is breaking it along its degrees of orthogonality, and there are three
-- two in Drupal core and one in the individual theme.
Scott
[5] http://drupal.org//user/1517
------------------------------------------------------------------------
April 17, 2005 - 07:14 : Dries
Scott, is right. The theme should export its available regions. Then
the administrator's task is to assign blocks to regions (not to setup
regions). A theme could have configurable regions, but that internal
to the theme.
To me, the real challenge is the UI and the interaction design.
Configuring blocks could easily become a real pain (while most themes
continue to use 'left' and 'right'.)
Of course, we can implement all the functionality, default everything
to 'left' and 'right', and worry about the UI later. This should be
fairly straightforward to implement and nedjo's patch looks like a
first step in the right direction.
------------------------------------------------------------------------
April 17, 2005 - 21:09 : nedjo
I agree with the suggested approach of themes registering their regions.
I'd see this happening when a particular theme is activiated (or
upgraded). Regions would be an array of names (e.g., 'left', 'right',
'footer'). New records would be created in the region table only for
region names not previously registered.
Some areas I'm not clear on, or that need further work:
* Table naming
Should a new table be 'region' or 'regions' (I've used 'region')? I
don't see a convention among existing table names, some of which are
singular and others plural.
* Default values
I've kept the existing '0' and '1' ids for regions (left and right,
respectively), for backward compatibility. But this means we can't use
autoincrement for the region id (rid), since autoincrements seem to
begin with 1. Likely we should change to autogenerated ids.
* Initial records
Using the INSERT INTO statements as I've done for the initial region
entries is probably counterproductive, since sooner or later they'll
have to be dynamically generated. I was hoping this could be a
preliminary patch, with the main work coming later, but likely we need
to solve region registration by themes before this patch is applied. I
don't have a good idea of how region registration by themes would be
implemented (a hook on theme activation?), and invite suggestions or
implementations.
* Theme system changes
Besides region registration, the other change I'm seeing that would be
needed in the theme system is loading blocks by region name, rather
than region id. This is because the ids currently used ('0' and '1')
in theory might be diffferent on a particular install.
------------------------------------------------------------------------
April 17, 2005 - 21:18 : syscrusher
Instead of having themes "register" their regions, why not just add a
theme API hook called them_regions() that returns an associative array
of $region_name=>t($region_helptext)? This would be in keeping with
other similar API functions, such as those that return what permissions
apply to a module or what node types are defined by a module. Most
themes are going to define only a small number of regions (two being
the typical case now, but I could see five or six in a complex theme),
so returning a constant array will be faster than querying SQL to
obtain an array of rows.
There could be (optionally, at the discretion of whoever builds this
thing) another API hook like theme_region_properties($region_name) that
returns an associative array with detailed info for a given region, such
as extended help text with recommended usage instructions for the
region.
Scott
------------------------------------------------------------------------
April 17, 2005 - 21:19 : syscrusher
s/them_regions/theme_regions/g
------------------------------------------------------------------------
April 17, 2005 - 22:47 : adrian
Because. The most common 'theme' is a phptemplate theme.
And there needs to be a generic method for specifying the regions
available, in a non hook_function format..
Themes get their names from the directory in which they are contained..
when copying the theme to another directory, there must be _no_
modifications necessary to allow normal usage. This is one of the
tenets of the new template system I designed.
You would need a standard way to define meta-information for themes,
that does not need to be modified when copied to a new directory. We
are working on this in the install system work, as you need a way
external of Drupal to define the module dependencies and some other
things.
My approach would be to add a theme.dsc text file to the directory,
which would allow you to specify meta-information. For instance :
----
regions: left, right, footer, center, mountie
author: Johnny McAngstyPants
----
------------------------------------------------------------------------
April 18, 2005 - 02:00 : syscrusher
Adrian wrote:
"
Themes get their names from the directory in which they are contained..
when copying the theme to another directory, there must be _no_
modifications necessary to allow normal usage. This is one of the
tenets of the new template system I designed.
"
A very good point. But region names don't have to be unique across
different themes, so my hook function wouldn't have to be modified. The
suggestion I made for the mapping metadata was three factors: theme ID
or name, region ID or name, and block ID (plus one non-key weight value
to order the blocks within a region, but this is not relevant here).
I'm not familiar enough with PHP template to be able to respond to your
comments on that one, so if you say it's not feasible to work with my
schema, then I'll take your word for it. :-)
Scott
------------------------------------------------------------------------
April 18, 2005 - 02:03 : syscrusher
Oh, wait.....I see now what you mean! It's not the output of the
function that is the problem, but the *name* of the function.
Never mind. I concede your point.
Scott
------------------------------------------------------------------------
April 18, 2005 - 07:44 : Jaza
I'm probably jumping ahead a bit here... but something that this patch
will have to eventually account for, is how to allow regions to be
defined as inline. Allowing a theme to define a region's position as
being anywhere on the edge of the page (i.e. top, left, right, bottom,
corners, etc) is relatively easy. But what about having a region that's
in the middle of a node's body, or somewhere else that's not the edge of
the page?
What I'm thinking of, is eventually allowing the custom region system
to integrate with the CCK. Like I said, I admit that I'm jumping ahead
into the future - the CCK still has a long way to go before it's ready.
But ultimately, it would be cool if a theme could define a region as
being after, say, the "rating" field in nodes of type "movie review".
This would make the region (and the blocks in it) truly inline and in
context with the actual content of the node.
This would be a huge step forward compared to the current block system,
which doesn't allow you to mix the presentation of blocks and nodes at
all. In Drupal ATM, blocks and "the rest of the page" are totally
separate, and really you have no choice but to display them as such.
The result of this is that information in blocks that really should be
displayed as part of a node, gets literally "pushed to the side", and
always seems secondary to the actual content. Often the block has
content that is just as important as the content of the node itself.
Another option (of less merit, IMO - because of the extra maintenance
work, and lack of enforced consistency) would be to have a region
filter. You could then choose where to place an inline region on a
per-node basis, by entering text such as [region:2] (example based on
image_filter syntax) into the node body.
Anyway, just thought I'd throw that idea into the open. I don't expect
it will be implemented any time soon, but it's something to think
about.
Jeremy
------------------------------------------------------------------------
April 18, 2005 - 08:54 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions---possibility-1.png (1.29 KB)
Imo the 'regions' are more than you guys name here.. FOr example I
attached 2 screens which only shows you the regions.. What I think is
that it should always be possible to have free names for the regions.
No matter if i call - the region where my content appears in -
'content' or 'site items'..
See attached screens..
------------------------------------------------------------------------
April 18, 2005 - 08:56 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions---possibility-2.png (1.39 KB)
And the second...
See these links:
- http://drupal.org/files/issues/regions---possibility-1.png
- http://drupal.org/files/issues/regions---possibility-2.png
------------------------------------------------------------------------
April 18, 2005 - 15:22 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions2.patch (13.39 KB)
Here's a revised patch implementing some of the ideas so far. I've used
the theme engine - rather than individual themes - to generate the list
of available regions. I know this isn't ideal, but e.g. for xtemplate
it's at present the only option--no logic is possible in the individual
theme.
region is changed to a varchar field from the current tinyint.
I've roughed in several regions--really just for demo purposes. More
thought and work would be needed to refine them (e.g., styling, etc.).
But this maybe moves the conversation forward.
------------------------------------------------------------------------
April 18, 2005 - 21:26 : Dries
This patch enables different regions to be used. That is a good thing.
The next question is: should we take into account that different themes
could assign blocks to different regions? Lots of problems would be
solved if (i) there could only be one active theme on a website or (ii)
if all themes would have a common set of regions.
(This "let users select their own theme"-thing is a left-over from the
early days, except for WAP stuff maybe.)
------------------------------------------------------------------------
April 18, 2005 - 21:37 : killes(a)www.drop.org
Giving up multiple theme support would be a great thing. People could
still select from multiple style sheets. WAP shoud not be a user
preference setting, but automatically detected and redirected to a
special site with a WAP theme.
------------------------------------------------------------------------
April 18, 2005 - 21:48 : adrian
You would then lose the ability to make a special front page theme for
use with the sections module, for instance.
Also, currently styles exist in the same namespace as themes, and we
would have to make more a distinction of styles vs templates (or
themes), but I do think this could help simplify things.
------------------------------------------------------------------------
April 21, 2005 - 16:54 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions3.patch (15.69 KB)
The main issue raised, if I'm understanding well: if a theme or theme
engine is present that offers regions other than those available in the
default theme, any blocks assigned to those regions will be invisible to
most users.
Here's a revised patch addressing the concern. I've added a test for
each region to see whether it's also available in the current default
theme. (Actually, I'm realizing as I write this, I've used the theme
engine--so it would need to be updated to test first if an engine is
being used.)
In any case, any regions not available by default are starred, and a
message text appears (only if necessary).
If there's support for the approach, I'd be happy to finish the patch.
Remaining work:
* extend to work with non-engine themes
* finalize base set of regions to implement
* implement common region set in all core themes (for now I've only
done xtemplate)
* work on CSS display (how blocks in each region should look)
This last point I'm not too confident on and would look for
help/suggestions.
Screenshot to come.
------------------------------------------------------------------------
April 21, 2005 - 16:56 : nedjo
Attachment: http://drupal.org/files/issues/block_regions_message.png (12.34 KB)
Screenshot showing starring of non-default regions plus message.
------------------------------------------------------------------------
April 21, 2005 - 17:19 : killes(a)www.drop.org
I like that approach. +1
------------------------------------------------------------------------
April 21, 2005 - 17:23 : resmini
My two cents.
If this has to be done (and it should), better get rid of spatial
definitions for areas such as left, right, top, bottom, etc.
Use semantic names related to content and let the theme take care of
their positioning interely.
Also note that there in an ongoing debate in IA trying to build up a
standard naming convention for page regions in a way that is
semantically (and logically) correct. Just for the sake of it, you can
check
http://www.stuffandnonsense.co.uk/archives/whats_in_a_name.html
http://www.stuffandnonsense.co.uk/archives/whats_in_a_name_pt2.html
with follow-ups, including Eric Meyer's. There are more substantial
contributes in the AIfIA web site, but I can't seem to find them now.
I'll post a link or an abstract if I manage to.
--
vector at exea dot it
------------------------------------------------------------------------
April 21, 2005 - 18:15 : nedjo
Good points, useful references. The default regions I'm thinking of
are:
'banner' => t('banner'),
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
'footer' => t('footer')
Perhaps "body" would be better as "content"? It would be easy enough
to add in more regions, e.g., within the content (after title, after
help, etc.) One issue is that many of these regions will already have
rendered content. Should the blocks come before or after that other
content? I've assumed after for banner and footer, while giving both
options in body.
In any case, refinements or suggestions would be great.
------------------------------------------------------------------------
April 21, 2005 - 18:56 : resmini
Well,
'banner' => t('banner'),
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
'footer' => t('footer')
The classic (as far as classic goes for something Web related) scheme
comprises 5 spatial regions, much like stefan's
http://drupal.org/files/issues/regions---possibility-1.png with a left
area mirroring the one called 'blocks'. Call them top, left, center,
right, bottom.
Variants usually exclude one or more of these, layout-wise.
If we talk content (semantic) instead, things get a bit more
complicated, as these spatial regions normally include more than one
content-area. The top, for example, could include ad banners and the
site's header, or the main menu. But these merge seamlessly with CSS
definitions, which are definitely something that should get properly
standardized (most of the errors / inconsistencies I'm encountering
with Drupal today are related to this), but this is out of scope in
this thread.
What I somewhat object to the definitions above is that it mixes the
two approaches.
'banner' is not spatial, is content, as it is the distinction between
body top and bottom. If 'banner' goes there, it is 'top', whatever that
might be. I designed a couple of web sites which had
headers/logos/banners at the bottom of the page, and I'm not exactly
the wildest designer you'll probably meet.
And if we include body_top and _bottom, we should also add
'navigation', or 'menu' and some other content-related semantic region
(impressum, or company_data, or whatever).
I suggest that either we go along
'top' => t('banner'),
'left' => t('left sidebar'),
'center' => t('body'),
'right' => t('right sidebar'),
'bottom' => t('footer')
or we dedicate some time to detailing what could possibly fit there
semantically, which is perfectly possible without limiting design
freedom or whatever, since the vocabulary is not infinite, but not
something you do out of the blue.
Please note that I understand t('something') to be an example, since
such a layout only defines regions on the page, not semantic regions.
My main content could fit nicely in the bottom region.
As for the names for the regions, they are not important, as much as
they are coherent and enforced.
------------------------------------------------------------------------
April 21, 2005 - 21:16 : stefan nagtegaal
Attachment: http://drupal.org/files/issues/regions-final.png (2.39 KB)
Maybe something like this???
But, I have to say that I _really_ liked the solution to split the
'content'-region into the 'content' and 'beneath content'.. I love
that!
------------------------------------------------------------------------
April 21, 2005 - 22:20 : resmini
Stefan, yes.
That's basically what you can build if you stick with spatial, and this
layout can generate quite an amount of (sane) layout variations even if
you interpret it strictly (suppose a default) as
<div id="header">
</div>
<div id="left-bar">
</div>
<div id="content">
</div>
<div id="right-bar">
</div>
<div id="footer">
</div>
What you can do with this is left basically to the theme designers and
their use of CSS, CSS-P or tables (brrr), but this could be an easy and
proper way to identify macro-regions in which more accurate positioning
happens at a more specific level.
I'm all in favour of subsequent identification of sub-areas (top and
bottom in body), but I don't think it would be a good idea to mix the
different approaches I mentioned in my previous post.
A site with lots of things going on or which is not just blogging
surely has the need to use its content area in a wiser manner than just
putting there 'content', the number of modules doing precisely this is
more than proof, but that falls more in a 'Drupal definitive guide to
semantics', in which CSS selectors are used or suggested strategically
for such a scope.
>From this point of view and for the sake of this thread, any unique
area / div (#name) could (should?) be a target for blocks, and this in
my opinion (*) would be the perfect solution, but I do not know if and
how this is even remotely possible in the current Drupal.
(*) It's quite late, local time, and it was a looong working day.
------------------------------------------------------------------------
April 21, 2005 - 22:38 : resmini
Attachment: http://drupal.org/files/issues/regions-final-variation.png (1.9 KB)
Just to be clear, I add a variation of stefan's scheme that shows how
this is *not* by any means positional, but spatial, or better
relational. Use your CSS imagination to take out regions, reduce them
to empty containers, enlarge them, make them taller, shorter, whatever.
5 regions, do what you like.
------------------------------------------------------------------------
April 21, 2005 - 22:44 : resmini
Sorry, I forgot.
And this is also why I'm not too keen on calling anything 'content'. If
I enlarge my right region enough, why not put my content there?
Shouldn't this be a theme-level concern?
It's nothing serious, but if my center area is called 'center' (or
something similar and more sexy), I won't confuse anybody.
This is left, center, right: do with them what you prefer. Content in
the bottom? Show me.
If I call something 'content', I'm more than suggesting that content
goes there, and only there.
------------------------------------------------------------------------
April 22, 2005 - 08:17 : stefan nagtegaal
Resmini, maybe it is only me but I think that you are making a mistake
in your way of thinking..
I get the feeling that you're mixing the 'regions' and 'divs'.. the
'regioins' should have meaningfull sentences, but the divs
shouldn'thave..
As an example:
$region_name => $content_body
here we go:
'header' => $logo
'left sidebar' => theme('blocks', 'left')
'right sidebar' => theme('blocks', 'right')
'content' => $content
'footer' => $footer.
So, $region_name does not have to be equal to the id or class of the
divs..
------------------------------------------------------------------------
April 22, 2005 - 09:27 : resmini
Stefan,
>So, $region_name does not have to be equal to the id or class of the
divs..
Yes, absolutely. I probably didn't make myself very clear: what I'm
trying to point out is that in
'header' => $logo
'left sidebar' => theme('blocks', 'left')
'right sidebar' => theme('blocks', 'right')
'content' => $content
'footer' => $footer.
there is no reason at all to call 'content' the region that holds
$content.
nedjo asked in #24
'body_top' => t('body top'),
'body_bottom' => t('body bottom'),
if /Perhaps "body" would be better as "content"?/ and all my reasoning
is simply that no, that is not content, or it shouldn't be (or better:
it may happen that main content is elsewhere). As a matter of fact,
even the connotation 'sidebar' doesn't fit very well logically.
To make it short: Today's method works, but has limits. Mambo, which
paragkenia quotes at the beginning, handles more 'user regions' but in
pure Mambo style conventions are so loose that they are hardly useful.
If we define regions, as in nedjo's example, in my opinion these
regions shouldn't imply informational layouting, only relational
positioning (that is, where they stay in the browser viewport).
I know it may look like overdesigning, but Drupal constantly enforces
conventions and coding guidelines everywhere: this is one of the best
aspects of the project and I think it should carry to the layout.
------------------------------------------------------------------------
April 22, 2005 - 09:32 : stefan nagtegaal
While I think that 'body_*' is not as self explaining as 'content_*' I
vote for using 'content_*'..
------------------------------------------------------------------------
April 25, 2005 - 17:48 : chx
Let's get back to the code. If my understanding is correct the big
discussion is about how to name potiental rectangular areas _after_
this is commited. So, first get this committed. What's need to make
that happen?
------------------------------------------------------------------------
April 25, 2005 - 18:56 : chx
I spoke with Moshe, Steven, JonBob and the result is: keys shall be
numbers, and themes shall define the values. We will make region zero
and one required. There will be a define('REGION_CONTENT', 0) and a
define('REGION_SIDEBAR', 1); so you can have readable code still.
Either wait for me to code it or feel to do it yourself, just drop me a
mail via the contact form if you are doing it.
------------------------------------------------------------------------
April 27, 2005 - 16:14 : nedjo
Károly, it's great if you're willing to take on finishing this. I
tried to summarize remaining work in update 20, above [6].
The numerical keys look fine to me.
In terms of an initial default set of regions, one quirk is this: for
now, so far as I can see (and assuming the approach I sketched in),
available regions can be defined only in (a) theme engines and (b)
individual themes that don't use an engine. So, for instance, an
individual xtemplate based theme can't define its own custom regions;
they need to be defined in the theme engine. (Unless and until the
whole theme system should switch to the sort of configuration file
adrian suggested above [7].)
Which is to say that, under this approach, we'll be defining a set of
regions for each engine, and then all themes using that engine should
try to implement those regions. (Otherwise, if a site admin selects a
region defined in the engine but not implemented in the default theme,
the content won't appear.)
Please let me know if there's anything in what I've done that isn't
clear, or if you want to pass some or all of this back.
Thanks!
[6] http://www.drupal.org/node/16216#comment-27398
[7] http://www.drupal.org/node/16216#comment-27052
------------------------------------------------------------------------
May 9, 2005 - 20:36 : chx
I had a "short" discussion with the UI team leader ie. Ber Kessels. The
outcoming is that we will change hook_block so that it uses callbacks a
bit like menu system. Here's an example:
<?php
function module_block() {
$items = array();
$items['module_header'] = array('callback' => 'mymodule_page',
'weight' => -50, 'region' => 'content' , 'cache' => TRUE, 'pages' =>
"node/*\n<front>");
return $items;
}
?>
Please note that we are allowing caching the themed output of each
block independently.
The theme system will execute hook_block as it does now and it'll
execute the callbacks defined in module_block as well. Of course if the
callback is cacheable and in the cache, it'll print it from cache. If
it's themeable and not in the cache, it'll cache it before printing.
Pages contains a string (could be PHP code!) which can be overriden in
the block configuration screen.
Callbacks defined in hook_menu will have lot less functionality after
this, they will be used for non-themed pages mainly.
------------------------------------------------------------------------
May 9, 2005 - 20:45 : chx
More explanation is requested for the example.
module_header is the unqiue name of the block.
pages define on which pages the block is visible. ('pages' in the block
configuration screen.) Maybe I'll implement 'visibility' from the same
screen as well.
callback, weight are well known Drupal terms.
cache is a boolean which defines whether given output is cacheable or
not.
------------------------------------------------------------------------
May 9, 2005 - 20:47 : chx
Ber, Dries, do not kill me! Ber chaired the usability meeting in
Antwerp, that's all.
------------------------------------------------------------------------
May 9, 2005 - 20:52 : Bèr Kessels
Attachment: http://drupal.org/files/issues/more_regions_principle.png (123.29 KB)
attached is a schematic which might clarify this a little.
And I would also like to comment on me being the UI leader: I do not
consider myself any leader, no ofeence, though. Just to clarify that.
------------------------------------------------------------------------
May 9, 2005 - 22:42 : nedjo
I am not opposed to the idea of changing the _block() hook to use
callbacks (I have no opinion on it, not immediately grasping the need),
but this seems quite distinct from the aim of enabling multiple and
extensible regions. Why can't we just move ahead with the block
generalization?
I suggest:
* quickly implement the proposed block region generalization, using
only the two existing regions (i.e., implementing them in core themes)
* later worry about:
- adding further regions (the details of which are best done by those
primarily responsible for the particular themes)
- possible changes to the _block() hook.
Wouldn't this make sense? Or am I missing some pressing reason for
which the block generalization has to wait?
------------------------------------------------------------------------
May 10, 2005 - 01:28 : killes(a)www.drop.org
"Or am I missing some pressing reason for which the block generalization
has to wait?"
I might be missing something too, but I thought Chx was just talking
about the block generalization and proposing a way to code it.
------------------------------------------------------------------------
May 10, 2005 - 02:41 : factoryjoe
I wanted to chime in with this discussion because it's an important one
and has some really huge implications for Drupal moving forward. That
said, I also have a day job pulling all my attention which means that
the big ideas I have for this problem can't be put into a complete
visual form for at least a week or more. In the meantime, I'd like to
offer a few thoughts on the matter.
* *Regions do not belong in themes.* Blocks were originally separate
from themes for a reason. Themes should define the general look and
feel of a site -- and to some extent a site's behavior. Layouts which
define the spatial relationship between regions belong in some
intermediary between style and content, which does not currently exist
in Drupal.
* I would propose that *layouts become a new kind of CCK tool.* By that
I mean that they can be defined, shared and deployed very easily -- even
as simply as tossing a directory of some .layout textfiles into a
layouts/ directory. Note that this suggestion has nothing to do with
the way CCK /might actually/ work right now; instead I'm suggesting how
I would like it to work. I would like, for example, to create a CCK item
like a "person" and ship it with a .layout file that carries all the
semantic goodness needed to output that "person" to the screen in
juicy, semantic markup... which anyone can come along and theme to
their heart's content.
* *Creating shareable layouts should be relatively painless.* Dashboard
[8] sets the bar for easy hackability. It should be that easy to create
layouts for Drupal... I can imagine creating an "iTunes layout" or an
"Image Gallery" layout and so on... If we used something akin to PHPTal
to develop the layouts, we could keep development fairly standard while
making it possible for more folks to hack up cool and innovative
layouts.
* *Layouts should be extensible.. to a degree.* I see a huge problem
with how this discussion has floated back and forth between semantic
and spatial region naming. Because we talk about this problem in those
terms, we fail to identify the real problem and opportunities presented
to us. Here's the thing: when you predefine regions, you limit
creativity and the ability of people to really use the system. On the
other hand, when you make a system too flexibile, it quickly becomes
unwieldy. In all the mockups presented above, both classes of problems
would arise. Therefore we need to think about a way to stay flexibile
while "taming the beast."
* To that end, I suggest developing *self-contained layouts that are
contextually-complete.* So for the example of the iTunes search
layout... you would know before hand that you get a couple multiple
select boxes that you can hook up to whatever taxonomies you want to
progressively filter [nodes]. You could even change the .layout file,
allowing you to theme it to your liking -- even though that would
totally optional, given the layout's internal default styling. Once
you've got your layout, you would go into a layout module UI [9],
create a new layout [10], select the layout from a list [11] and then
give it a path so you can access the layout... You would then walk
through a wizard [12] that would help you populate that layout with all
kinds of nice Drupally goodies... feeds, node listings, PHP code, etc.
The power in this approach is multifold. For one, it snaps Drupal out
of its block mentality and allows designers to really innovate with
individual page designs. In fact, I've already thought out how I could
reimplement Flickr using this system, combined with Drupal's native
feeds, taxonomy and menu module, and I'd barely break a sweat... sort
of. ;)
But anyway, this is a very productive conversation to be having, but I
really think that we should consider whether the old paradigm, as such,
really pushes Drupal as far forward as we have the opportunity to go.
[8] http://drupal.org/apple.com/macosx/theater/dashboard.html
[9] http://photos4.flickr.com/6944826_90af237c99_o.png
[10] http://www.factorycity.net/demos/civicspace/layout/new.html
[11] http://www.factorycity.net/demos/civicspace/layout/new_layout.html
[12]
http://www.factorycity.net/demos/civicspace/layout/testing_add.html
------------------------------------------------------------------------
May 10, 2005 - 04:34 : chx
While factoryjoe may be right, I could be right as well.
Regions has definitely something to do with themes, after all it's the
theme that renders the page, and it can only render regions that it
knows of.
So, instead of postponing this into the far future when someone comes
out with a layout system, I code this now.
------------------------------------------------------------------------
May 10, 2005 - 05:22 : Dries
The proposed 'weight', 'region' and 'pages' would be configurable, not?
Are these just defaults? The 'callback' and 'cache' options are nice to
have.
------------------------------------------------------------------------
May 10, 2005 - 05:25 : chx
Yes, blocks can provide a default for everything on the block and and
configuration screen. Of course, you can override these in the UI.
------------------------------------------------------------------------
May 10, 2005 - 09:02 : Bèr Kessels
Dries: yes, the region, weight and pages will be configurable from an
admin interface. What we tried to address here, is a method for
developers to choose good defaults. Take for example "logo". that
should be enabled by default in a regions called header, rendered on
all pages, and have a very light weight. We should not force an admin
to visit the blocks admin before she can see or use the logo.
Chris: I do not know if you have ever tried typo3. Its concept is some
form of builder system. I do not like thar, because far too complex. If
we ever get sme kind of builder in core (if ever) it will require a lot
of work, and even more usability research. So for now such a builder is
far out of our reach. Lets aim at goals that are more realistic ;) So:
it does belong in themes, its the best place that is still realistic.
I do like your visions, Chris, but I hope you agree they are not
realistic, yet. So, maybe you can think of a path towards your visions,
ow we can reach such a builder-system, you describe?
------------------------------------------------------------------------
May 10, 2005 - 14:52 : factoryjoe
My browser crashed before I was able to submit my followup to chx's
comment... I have no problem with the current work going forward and am
happy to see it happening. I know that my ideas are typically
outlandlish and far off... That's the kind of design I enjoy doing!
In any case, I see chx's solution being a means to an end; once we have
abstracted the region code, it become much easier for me to get some
help creating my vision.
In the meantime, and as a demonstration of how I see this layout system
working (to answer, I hope, Ber's concerns about clunkiness), I've
created a workflow movie that shows off how fast you'd be able to add
content to the system.
Check it out:
http://factorycity.net/demos/civicspace/layout/media/layout_workflow_v1.mov
Feedback appreciated. And, if you want to try the demo out yourself
(it's all hardcoded, like a "movie set" for my UI), go here:
http://factorycity.net/demos/civicspace/layout/
------------------------------------------------------------------------
May 12, 2005 - 16:45 : nedjo
Attachment: http://drupal.org/files/issues/block-dynamic-regions4.patch (13.56 KB)
"I might be missing something too, but I thought Chx was just talking
about the block generalization and proposing a way to code it.
"
Well, if I can say so respectfully, I don't think so. Not so far as I
can see identifying problems with my original patch, this interesting
discussion is rather addressing the (useful, but logically subsequent)
question "once we have multiple regions, how should we work with
them?". It's perhaps demonstrating our propensity to try to do more
rather than less with a given patch--to talk for a long time when a
first step solution is already in place. So here is a (yes, interim!)
small, focused, and tested patch to remove the hard-coded regions.
I've stripped it down so it does nothing more than (a) make block
regions declared by themes rather than hard-coded and (b) implement the
existing left and right regions in existing core themes. Please, try it
out, I think you'll like it. I'm of the (I'm hoping not scandalous)
opinion that it can be applied right away, and so clear the way for
further progress. In particular, this patch leaves the adding and
configuring of additional regions to theme authors/maintainers, who are
best qualified for the work.
"I spoke with Moshe, Steven, JonBob and the result is: keys shall be
numbers, and themes shall define the values. We will make region zero
and one required.
"
The reason I moved from numbers to strings (e.g., "left") is that a
theme author defining regions has no way of knowing what regions might
have already been defined, and therefore what integers might have
aleady been used. It's like module and theme names--we'd have to use
random numbers to avoid conflicts, so we're better off with string
names.
------------------------------------------------------------------------
May 12, 2005 - 18:17 : Bèr Kessels
nedjo,
I am not a fan of your solution for blocks that dissapear. It breaks
the ability to allow more themes on a site. if important blocks dont
show up, your site will simply break. I would rather suggest that every
theme MUST have a region called 'default'. any blocks that want to go
into a non-existing region, will be placed there.
We must define a standard listy of suggested region names. to avoid a
wildgrowth of names.
I am not sure if i like the way you do function phptemplate_regions().
these regions should be defined in the templqtes, not the engine.
Otherwise all phptemplate themes will still all have two regions.
Note that i did not test your patch thouroughly, just applied and
looked at.
------------------------------------------------------------------------
May 12, 2005 - 19:38 : nedjo
Thanks for your comments. I think we're getting somewhere.
"I am not a fan of your solution for blocks that dissapear. It breaks
the ability to allow more themes on a site. if important blocks dont
show up, your site will simply break. I would rather suggest that every
theme MUST have a region called 'default'. any blocks that want to go
into a non-existing region, will be placed there.
"
Good suggestion. Having a default region for blocks to show up sounds
like a valuable backup. I'm thinking we might want to have a way to
designate a given region as the default, rather than having to have one
named 'default'. Thoughts?
"We must define a standard listy of suggested region names. to avoid a
wildgrowth of names.
"
Sure. But the patch doesn't prevent doing that--it enables it.
"I am not sure if i like the way you do function phptemplate_regions().
these regions should be defined in the templqtes, not the engine.
Otherwise all phptemplate themes will still all have two regions.
"
Oh, I wholeheartedly agree, and I've noted the issue above. But unless
we substantially rewrite the engines, some region definition is needed
in the engines, as they call blocks. Should we therefore define a base
set in the engine, then call a hook from the engine to add any other
regions from themes based on that engine? If so, where in the theme's
files should such a hook be located?
And a side note. Do let's make an effort to keep our comments
friendly. Taking the time to note one or two things that do work or
are done well as part of a review is I believe a valuable habit. It
helps to confirm what is indeed accomplished. Beyond this, it helps to
maintain the idea that we are collaborating on shared goals, rather than
pushing individual and competing visions, and that contributions and
work are appreciated, rather than being invitations to criticism.
Thanks, Nedjo
------------------------------------------------------------------------
May 12, 2005 - 19:42 : chx
I am implementing http://drupal.org/node/16216#comment-29282 but it
takes time. regions again have names. default and sidebar regions are
mandatory.
This has little to do with nedjo's code much more with his idea -- I
looked at the screenshot and said, OK this is great but... we'd like to
have a lot more 'blocks' if this comes through, henceforth the above
mentioned solution.
------------------------------------------------------------------------
May 12, 2005 - 20:39 : nedjo
Okay, thanks for the clarification, I hadn't understood that you were
taking a new approach rather than building on what I'd begun. Given
that that's the case, staging as I'd suggested obviously won't work so
I'm content to wait and see what you accomplish. I'd only suggest,
don't feel like you need necessarily to do everything all at once.
------------------------------------------------------------------------
May 13, 2005 - 08:34 : Bèr Kessels
Nedjo, sorry if the sound of my comment was hostile. it was never meant
to be that way. I am busy, and thus did not want to comment all the
things i liked about your patch, but chose to pick the much smaller
amount of things I thought could use some improvement. I will try to
keep in mind to be more friendly next times. Also, not all of us are as
fluent in English as our native English speakers. I think its good to
keep in mind that for a lot of us, communication in English is not as
easy as it may seem. For me, it often requires a lot of concentration
to get the subtleties right. I mean: I can type some English text, look
up words in the dictionary, but to get small yet important subtleties in
my texts is very hard, often.
But, that all said: I liked your patch.
------------------------------------------------------------------------
June 10, 2005 - 11:08 : jakeg
How far off is this from being officially released or at least usable?
If its usable now, what files will I need to implement it?
------------------------------------------------------------------------
June 10, 2005 - 12:19 : Kobus
Attachment: http://drupal.org/files/issues/regions---possibility-3.png (2.21 KB)
To add to Stefan's suggestions with the two screenshots, I modified one
of them a bit, and this is how I understand Jaza's post, and yes, I
agree, this would be a wonderful feature! I can't wait! Imagine how
good it would look if I had a theme that has a clear white background
(not visible blocks) and then these seemingly random boxes on the page,
as shown in the screenshot. Especially where I can place it anywhere
around the node like Jaza said with a [region:2] block etc.
I say again: I can't wait!
Kobus
------------------------------------------------------------------------
June 10, 2005 - 13:59 : chx
I need 3-4 hrs of peace to implement the callback based thing. That's a
lot these days. Let's hope I'll get on it in the following days.
------------------------------------------------------------------------
June 18, 2005 - 22:32 : chx
Here's an example again of how hook_block will look like:
<?php
function module_block() {
$items = array();
$items['module_header'] = array('callback' =>
'mymodule_function', 'callback arguments' => arg(1), 'weight' => -50,
'region' => 'content', 'cache' => TRUE, ''pages' => "node/*\n<front>");
return $items;
}
?>
Items are keyed by unique IDs. The template system will call
module_invoke_all('block'), put the rendered HTML of the blocks into
regions sorted by weight. The rendered HTML is cached if it is allowed.
More keys will be introduced later, but now basically we just throw
everything from block configure in here, and add callback, callback
arguments, region.
Node teasers or fullly rendered nodes are blocks, too. Almost
everything is. So, here what happens when we are on taxonomy/term/1:
taxonomy_render_nodes is called
it calls block_set('node_view', $weight, $node, $teaser, $page); a few
times, so a few node_view blocks will be on the page
later the theme system is invoked. It will ask the block system to
collect all blocks, dynamic and the static blocks as well. For all
dynamic blocks we have a block defined in hook_block somewhere, like
the definition above, with one exception: it will have a 'standalone'
=> FALSE pair, so it is not a standalone block which is automatically
rendered but something that needs to explicitely requested. Also, we
may define a 'suffix' => 'somefunction' pair which provides us with a
cache ID suffix. Look at the code below:
<?php
function block_collect_blocks() {
// get all block definitions
$static_blocks = module_invoke_all('block');
// iterate of the dynamic blocks set on the page
foreach (block_get() as $dynamic_block) {
// get the block definition for the given dynamic block
$static_block = $static_blocks[$dynamic_block['block']];
// merge the callback arguments from the dynamic and static.
dynamic_block['callback arguments'] is always set though
// may be empty
if (isset($static_block['callback arguments'])) {
$dynamic_block['callback arguments'] =
array_merge($static_block['arguments'], $dynamic_block['callback
arguments']);
}
// try to get a cache ID suffix
$suffix = function_exists($static_block['suffix']) &&
call_user_func_array($static_block['suffix'], $dynamic_block['callback
arguments']);
// if the block is cacheable or the suffix function says that
it is cacheable by setting a suffix
if ($static_block['cache'] || $suffix) {
// set cache ID
$cid = 'block:'. $dynamic_block['block'] .':'. $suffix;
// try to get the rendered HTML from cache
if ($block_rendered = cache_get($cid)) {
$return[$static_block['region'][$dynamic_block['weight']][]
= $static_block_rendered;
continue;
}
}
// render the block
$block_rendered =
call_user_func_array($static_block['callback'],
$dynamic_block['callback arguments']);
// store the block for return
$return[$static_block['region'][$dynamic_block['weight']][] =
$static_block_rendered;
if ($static_block['cache'] || $suffix) {
// if cacheable, do it
cache_set($cid, $static_block_rendered);
}
}
foreach ($static_blocks as $key => $static_block) {
// is this a stand alone block, like in Drupal 4.6?
if ($static_block['standalone']) {
// now, the above is repeated, save that we do not have a
dynamic_block here
$suffix = function_exists($static_block['suffix']) &&
call_user_func_array($static_block['suffix'], $static_block['callback
arguments']);
if ($static_block['cache'] || $suffix) {
$cid = "block:$key:$suffix";
if ($block_rendered = cache_get($cid)) {
$return[$static_block['region'][$static_block['weight']][]
= $static_block_rendered;
continue;
}
}
$block_rendered =
call_user_func_array($static_block['callback'], $static_block['callback
arguments']);
$return[$static_block['region']][$static_block['weight']][]
= $static_block_rendered;
if ($static_block['cache'] || $suffix) {
cache_set($cid, $static_block_rendered);
}
}
}
}
function block_set() {
static $blocks;
$args = func_get_args();
if (count($args)) {
$callback = array_shift($args);
$weight = array_shift($args);
$blocks[] = array('block' => $function, 'weight' => $weight,
'callback arguments' => $args);
}
return $blocks;
}
function block_get() {
return block_set();
}
?>
When to expire the block cache? Never. If functions can call
cache_clear all, they can be smart enough to cache_clear only those
blocks that are changed by them. Some blocks won't be cacheable
anyways, say there is little use in caching 'active forum topics'
------------------------------------------------------------------------
June 19, 2005 - 07:15 : Dries
Frankly, I don't understand what you are trying to say. What is a
'dynamic', a 'static' and a 'standalone block'? What is the suffix
for? What is the advantage of making node and taxonomy views blocks?
If there is no big advantage, this is just bloat. All in all, it looks
pretty complex to me.
If we make Drupal more flexible _and_ more complex, people will get
upset, and we end up being like Plone. Drupal's simplicity is
something to foster, as it allows people to go in, and change stuff.
The focus is to make Drupal simpler _and_ more flexible.
I merely spent 10 minutes looking at this (reading your explanation
twice, staring at the code), and the newly added complexity simply
turns me off. Maybe that is because I don't understand what we are
gaining.
------------------------------------------------------------------------
June 19, 2005 - 07:34 : Bèr Kessels
* The first thing we gain, is, very slmple: more regions.
But, how many? what regions? on what pages? in what location? bearing
which name? For all these issues we need some callback system. To allow
themers, administrators and module developers to give answers to all
these questions. what we have now: sidebars, with only admin settings,
is simply too limited: It takes serious hacking (~15 lines of code in
your theme) to get a login block in your header!
* The second thing we get for free: We are passing along chuncks of
HTML, so why not cache them in a central place.
Practice points out that our current cache is not used well. We leave
it to developers to cache. And developers are lazy by nature. Just
looks at all the places where caching should have been done, but is
not. 9/10contribs have at least one of these places.
You must actually see these issues separate. The new central blocks
pulling system, and the caching. the latter is something that we get
for free, a high level of advanced caching (how often has not been put
forward Drupal seiously lacks better/advanced caching?). But we get it
only for free if it is co-developed with the new regions blocks.
And Last but not least, everything is a block, from a themer point of
veiw. I know developers tend to think: I do the content, and do not
care about where and how it turns up. That results in a content-centric
system, what we have now. Everythng is built around aa single chunk of
content. while, in fact content, is yet another block. Look at
http://www.terminus1525.ca/index.php?l=en or
http://www.franklinpennsylvania.us/ as it stands now, its up to the
developer to concenate all the HTML in the center area, into a huge
chunk of HTML. While in fact everyone can see that these are a lot of
separate blocks.
------------------------------------------------------------------------
June 19, 2005 - 07:39 : Dries
Ber: I was talking about chx's latest changes, not the block system in
general.
------------------------------------------------------------------------
June 20, 2005 - 18:06 : nedjo
I appreciate the update on directions being contemplated, although I
find it confusing.
Again, I'd caution, let's keep focused on the aim at hand, and on a
staged solution. A bigger patch means greater complexity, more
difficulty getting meaningful review, and greater delays in getting a
priority change. We're currently in a position where we have two
hard-coded regions for blocks, a major issue if nothing else than
because it reflects poorly on Drupal's usability and versatility.
Moving from here directly to something like "everything you see
anywhere is a (nested) block in its own (nested) region" strikes me as
a bigger step than we need to take.
And in belated reply to Ber's note (#53 above [13]), thanks for the
thoughtful comments, I didn't mean to single you out and acknowledge
that language & cultural differences play a role, I feel we can all
benefit from attention to communication.
[13] http://www.drupal.org/node/16216#comment-29633
------------------------------------------------------------------------
June 21, 2005 - 19:39 : Dries
Even with the explanation in chx's sandbox, this is too complex for my
likings. Here is a suggestion: let's drop the caching and the
'suffix'-stuff. Let's also drop the 'complete' and 'incomplete' stuff.
Keep it _simple_, chx. IMO, you're creating a monster.
------------------------------------------------------------------------
June 22, 2005 - 20:47 : chx
nedjo, take over. I am out.
------------------------------------------------------------------------
June 22, 2005 - 22:51 : djnz
Quick and dirty solution? Let blocks be assignable to 9 locations - Top
left, middle, right, middle left, middle right, bottom left, middle,
right.
The actual location of these areas within a theme is up to a theme
designer, but the designer should include each of them - how about
$sidebar['tl'], $sidebar['tm'], $sidebar['tr'] ...
Backwards theme compatibility could easily be maintained by only
creating the $sidebar array if the theme has set (eg in its
template.php file for a PHPtemplate theme) a flag, otherwise generate
$sidebar_left from the blocks set (in sequence) to top left, middle
left, bottom left, top middle and middle middle (arbitrary break) with
$sidebar_right the remainder.
I appreciate I have no karma here and only superficial knowledge of the
Drupal code, but sometimes the clarity of a view unclouded by too much
information is useful ;)
------------------------------------------------------------------------
June 27, 2005 - 06:26 : nedjo
Attachment: http://drupal.org/files/issues/regioning.patch (24.74 KB)
"
nedjo, take over. I am out.
"
Um, okay. I've given the question some more thought and come to the
following conclusions:
1. If we take regions to be areas of the page that specific types of
content are rendered into, and a regioning system to be a system to
accomplish this, we already have a number of regions and different
types of regioning systems. They include:
(a) our current blocks system, and
(b) the various drupal_set_[region]() functions, like
drupal_set_comment().
(c) specialized hooks like our help system, which assembles content to
be rendered into a region.
2. LIkely we should tease out regions from blocks.
So attached is a next rough cut at regioning. Features:
* Default region is defined in general admin settings page
* Regions are defined in both engines and themes. A particular
engine-based theme has the regions it defines plus the engine's default
ones.
* Content can be written to regions in two ways: through blocks or
through drupal_set_content($region, $content) calls.
Initial comments are welcome. I'll work on getting a more polished
patch and also more explanation of the approach.
------------------------------------------------------------------------
June 27, 2005 - 06:43 : deekayen
Disclaimer: I offer no code for this, so this is just a bunch of
idealism I can't back up.
djnz's comment makes sense if you want quick and dirty, but it seems to
me the correct way to do things would be in terms of relatives. I would
think doing it right the first time would be easier than redoing block
location code twice. For example set a standard starting location;
perhaps the start is 100% height/width conceptually. If you want to put
something on the right, it would be the first block on the right of the
starting block - let the theme manage widths. Then if you want another
block on the right, or 10, just keep adding them relative to the others
kind of like the current ordering of book pages or like adding more TD
cells in a HTML table.
Using this example under the current standard layout, the main block
could be in the middle with with relative blocks on the left and right.
------------------------------------------------------------------------
June 28, 2005 - 10:26 : arnabdotorg
It would be totally awesome to see multiple regions in Drupal 5, if not
4.7.
This topic has been discussed several times before, noting them down
for reference:
http://drupal.org/node/2790 /[September 9th 2003]/
http://drupal.org/node/10653
http://drupal.org/node/13008
I also think it would be nice to have people implement multi-region
themes; see what problems we encounter, and learn from it.
1
0
Issue status update for http://drupal.org/node/25605
Project: Drupal
Version: 4.6.1
Component: user system
Category: bug reports
Priority: critical
Assigned to: Robin Monks
Reported by: nysus
Updated by: Robin Monks
Status: patch
Anyways, my patch still applies (chx had concerns earlier, but the patch
was made correctly and seems to be OK). And it's been tested to work.
I also like the fact that mine covers the entire user, and not just the
edit portion.
Robin
Robin Monks
Previous comments:
------------------------------------------------------------------------
June 23, 2005 - 13:06 : nysus
Any user, anonymous or otherwise, can go to /user/0/edit and edit the
account of the anonymous user.
------------------------------------------------------------------------
June 24, 2005 - 11:20 : Robin Monks
I'll take care of this one :-)
CONFIRMED on WinXP/Xitami CVS
Robin
------------------------------------------------------------------------
June 24, 2005 - 11:41 : Robin Monks
Attachment: http://drupal.org/files/issues/annon.user.edit.fix (1.92 KB)
Here is the patch. It removes the /edit and /delete operation from user
0.
Tested to work on CVS HEAD.
Robin
------------------------------------------------------------------------
June 24, 2005 - 16:32 : killes(a)www.drop.org
Attachment: http://drupal.org/files/issues/user-edit-fix.patch (999 bytes)
The patch didn't apply on head. I also like my solution better. ;)
------------------------------------------------------------------------
June 27, 2005 - 19:17 : Dries
killes: your patch looks broken. Shouldn't $user->uid be arg(1)?
------------------------------------------------------------------------
June 27, 2005 - 19:31 : killes(a)www.drop.org
One of us is confused, but who?
I don't think that $user->uid has to be == arg(1). it is a global var.
1
0