Template skeleton!

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Template skeleton!
« Reply #45, on September 14th, 2011, 10:47 AM »
re: rev 996...

loadBlock() can now add blocks before or after a specified layer *or* a specified block.
I decided, at least for now, to allow both kinds of objects as the target, without specifying their type. My code is rather simplish, and it will fail if you attempt to load before or after the 'html' layer (which actually makes sense... :lol:), but I just don't know if it's "all right" to mix the two types together at this point.

I mean... If I do it for 'before' and 'after', why couldn't a modder look for a block by its *semantic hint*?
Only, hints are for layers only. But it makes sense to have them for blocks as well. Maybe I'm going too far... Or maybe I just shouldn't use hints in the first place because it complicates things...?

I'd really, really appreciate to have Bloc's feedback as of now. I'm sure there are both problems and solutions I didn't think about...
Posted: September 12th, 2011, 10:52 PM

Also -- should I add a 'rename' type of addition? i.e. take an existing block and rename it to the new block... It's effectively the equivalent of 'replace' in loadLayer() (except for blocks, of course), but I don't want to make it too complex either...
And what about removeBlock() and removeLayer() functions? Would they be helpful at all?
Posted: September 12th, 2011, 10:56 PM

Bump!
Posted: September 13th, 2011, 09:37 AM

Bump again...

Also, I'm having trouble with XML and WAP2.
Codebase wasn't too solid to begin with. In SMF, if you look closely at the code, even if you're in XML mode, the software will still load a lot of useless things... For instance, in PM mode, it will still load the menu code even though there's nothing to show. Even in loadTheme(), it loads tons of things related to regular theming, even after it was determined that the index template won't be needed (and thus the theme won't be useful.)

Now, the 'funny' thing in Wedge is that I had overlooked that, and thus XML and WAP2 were calling hideChrome() before the layers were actually defined. Ah ah, good times...

Anyway, now I've fixed some of it but I still have a long way to do. Can you spell "all day long"? Can you believe I started this morning by actually looking into avatar code and a firm decision to implement it today? :lol:

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Template skeleton!
« Reply #46, on September 25th, 2011, 03:43 AM »
Hmm, I'm debugging loadBlock() because I ran into what I perceive to be a bug. What I'm trying to do is load a block below 'main' in Post. It works if I specify the default layer, but not if I select the actual block itself.

I found out why I couldn't select a block to add after. It seems that the main block isn't found when loadBlock steps through the layers. 
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Template skeleton!
« Reply #47, on September 25th, 2011, 09:28 PM »
Can you print_r($context['skeleton_array']) and print_r($context['layers']) for me before you run the function...? Thanks.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Template skeleton!
« Reply #48, on September 25th, 2011, 09:36 PM »
It might help to know what calls are placed in case there's something wrong (and also SVN rev)
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Template skeleton!
« Reply #49, on September 25th, 2011, 10:23 PM »
I'll get those in a few. It;s r1030.

Nao

  • Dadman with a boy
  • Posts: 16,082

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Template skeleton!
« Reply #51, on September 29th, 2011, 10:31 AM »
Bump for the above.


Also, is the feed block totally driven by the skeleton now rather than late-injected into the sidebar as it used to be? It just occurs to me that some of the things I want to do may well rely on the feed block of the sidebar for positioning/ordering.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Template skeleton!
« Reply #52, on September 29th, 2011, 12:07 PM »
Quote from Arantor on September 29th, 2011, 10:31 AM
Bump for the above.
Oh... For John, not me :P
Quote
Also, is the feed block totally driven by the skeleton now rather than late-injected into the sidebar as it used to be?
It's still injected later.
The reasoning behind this is that we want to have the block at the very bottom of the sidebar. We could call it through sidebar_below(), though...
Quote
It just occurs to me that some of the things I want to do may well rely on the feed block of the sidebar for positioning/ordering.
Before feed block: that's how it behaves...
After feed block: any reason for wanting that...?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Template skeleton!
« Reply #53, on September 29th, 2011, 03:53 PM »
No, I wasn't thinking of 'after feeds' but I could conceive of wanting things below all other content and thus 'above' feeds, and if late injected, it occurred to me that I couldn't necessarily rely on 'above feeds' for that.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Template skeleton!
« Reply #54, on September 29th, 2011, 04:48 PM »
No, but you can rely on asking for it to be 'last', because feeds will be injected last...
Of course, we could also have two streams in each direction:
loadBlock('my_block', 'sidebar') would add a block in the normal direction.
loadBlock('my_block', 'sidebar', 'from_end') would add a block in the opposite direction.
So we'd just need to call loadBlock('sidebar_feeds', 'sidebar', 'from_end') ASAP, and then all 'from_end' calls will put the block above feeds. Of course, normal direction will mean it's always added between the current 'normal' position and the 'from_end' position.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Template skeleton!
« Reply #55, on September 29th, 2011, 05:02 PM »
Yea, I had forgotten that.

That could be good, though I'm a little concerned that we're providing too many variations on a theme - though if we can find valid uses where it would achieve the job better than manual juggling or non-obvious uses (like the above example), then we can run with that too.

Nao

  • Dadman with a boy
  • Posts: 16,082

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Template skeleton!
« Reply #57, on September 29th, 2011, 07:38 PM »
Would adding the streams provide something that currently can't be done without a lot of work?[1] If not, don't change it.
 1. To me, the answer seems to be no.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Template skeleton!
« Reply #58, on September 29th, 2011, 07:49 PM »
In the case of the sidebar I guess yeah?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Template skeleton!
« Reply #59, on September 29th, 2011, 07:52 PM »
In the case of the sidebar, new elements are either going to be before or after existing elements, I just didn't immediately realise that 'before feeds' meant 'last in queue', since I don't really imagine anything adding itself after the feeds block...

Given that, is it worth the extra hassle?