This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
7921
Features / Re: Template skeleton!
« on September 8th, 2011, 02:16 PM »
I'm hoping to have this on SVN by tonight...
Most of the stuff is working now. I'm having more issues though, so I'll just mention them here.
- seems like having a page sent in XML will crash everything. I've only seen this quickly, it seemed to me but it seems like XML will bypass many things in loadTheme() or something... (And it makes sense, since this codepath will generate its entire 'HTML' from scratch.)
Pete, any memories about this?
- I'm working on a "loadLayer()" function, similar to loadSubTemplate()... I'd like for it to be logical in its execution and settings. When exactly do we want to add a layer, and what for? Generally it's because we want to add something around the code being executed. The main issue I'm having here is that if it means adding a layer to the 'main' layer, any subsequent layers added will become parents of the earlier added layers. It's not a big problem to me but I don't think SMF does it in that direction... (Does it?)
Also, I'm having fun (ah ah... not exactly) trying to figure out how to quickly rename an array key. It's easy enough when your array doesn't need to preserve order... But when you start having to use array_splice when this one doesn't work with associative arrays and doesn't even preserve key names, meh... I guess I'll have to do my own routine that rebuilds an array from scratch. Ah ah, fun, as I said...
And these are my two current issues :P
Okay, renaming keys was easy enough, surprisingly... And fast.
However now I'm wondering what's best. By default, layers are added to the 'main' layer (you can choose your target layer, otherwise it's not cool.)
Should they be added *inside* the layer, or *outside* it? i.e. adding a <layer2> to <main> in <layer1><main><output /></main></layer1> should result in what...?
<layer1>
<main>
<layer2></layer2>
<output />
</main>
</layer1>
<layer1>
<main>
<layer2>
<output />
</layer2>
</main>
</layer1>
<layer1>
<layer2>
<main>
<output />
</main>
</layer2>
</layer1>
Of course I can include an option to do any of the three, but I'm sure there's going to be at least one option that never gets used... And we're bound to find people complaining they can't add an empty layer at the *end* of an existing layer... :lol:
Oh well, maybe it's not very important... I mean, adding a layer to the end manually can be done very easily: $context['layers']['main']['my_layer'] = array();
And at the beginning, my first guess would be to do something like: $context['layers']['main'] = array('my_layer' => array()) + $context['layers']['main'];
(And yes, I suppose I can add wrappers for these, too...)
Most of the stuff is working now. I'm having more issues though, so I'll just mention them here.
- seems like having a page sent in XML will crash everything. I've only seen this quickly, it seemed to me but it seems like XML will bypass many things in loadTheme() or something... (And it makes sense, since this codepath will generate its entire 'HTML' from scratch.)
Pete, any memories about this?
- I'm working on a "loadLayer()" function, similar to loadSubTemplate()... I'd like for it to be logical in its execution and settings. When exactly do we want to add a layer, and what for? Generally it's because we want to add something around the code being executed. The main issue I'm having here is that if it means adding a layer to the 'main' layer, any subsequent layers added will become parents of the earlier added layers. It's not a big problem to me but I don't think SMF does it in that direction... (Does it?)
Also, I'm having fun (ah ah... not exactly) trying to figure out how to quickly rename an array key. It's easy enough when your array doesn't need to preserve order... But when you start having to use array_splice when this one doesn't work with associative arrays and doesn't even preserve key names, meh... I guess I'll have to do my own routine that rebuilds an array from scratch. Ah ah, fun, as I said...
And these are my two current issues :P
Posted: September 8th, 2011, 01:58 PM
Okay, renaming keys was easy enough, surprisingly... And fast.
However now I'm wondering what's best. By default, layers are added to the 'main' layer (you can choose your target layer, otherwise it's not cool.)
Should they be added *inside* the layer, or *outside* it? i.e. adding a <layer2> to <main> in <layer1><main><output /></main></layer1> should result in what...?
<layer1>
<main>
<layer2></layer2>
<output />
</main>
</layer1>
<layer1>
<main>
<layer2>
<output />
</layer2>
</main>
</layer1>
<layer1>
<layer2>
<main>
<output />
</main>
</layer2>
</layer1>
Of course I can include an option to do any of the three, but I'm sure there's going to be at least one option that never gets used... And we're bound to find people complaining they can't add an empty layer at the *end* of an existing layer... :lol:
Oh well, maybe it's not very important... I mean, adding a layer to the end manually can be done very easily: $context['layers']['main']['my_layer'] = array();
And at the beginning, my first guess would be to do something like: $context['layers']['main'] = array('my_layer' => array()) + $context['layers']['main'];
(And yes, I suppose I can add wrappers for these, too...)
7922
Off-topic / Re: Baidu bloody loves me.
« on September 8th, 2011, 08:54 AM »
It's because Wedge will not be released in English. Its language strings are from now on hardcoded to Mandarin. Did we forget to tell you? China is the biggest market now.
Oh and because ie6 is the leading browser in China, I've dropped compatibility with other browsers. Standards are too annoying to follow.
Oh and because ie6 is the leading browser in China, I've dropped compatibility with other browsers. Standards are too annoying to follow.
7923
Plugins / Re: Converting WedgeDesk
« on September 7th, 2011, 11:50 PM »
Pete. Does it use custom CSS? Is the enclosing div called edge or edgehide?
Wickets?
Eh! Let's rename our plugin system to Wedgets :P
Wickets?
Eh! Let's rename our plugin system to Wedgets :P
7924
Features / Re: Template skeleton!
« on September 7th, 2011, 11:11 PM »
I don't know if it's going to amount for new functionality, but it'll sure make more sense IMHO... *And* it'll make for easier debugging if you can't figure out why your block won't show up.
print_r($context['skeleton']);
Done... :lol:
Of course, adding ?debug or ;debug to the URL is also a nice solution. (I did it yesterday to debug the new stuff. I have no idea why it's not exactly a documented feature...)
print_r($context['skeleton']);
Done... :lol:
Of course, adding ?debug or ;debug to the URL is also a nice solution. (I did it yesterday to debug the new stuff. I have no idea why it's not exactly a documented feature...)
7925
Features / Re: Template skeleton!
« on September 7th, 2011, 11:03 PM »
Okay, I've done it -- split wedge_cache_css into two functions. The first one is called in loadTheme() and will build the correct list of CSS folders for use in skins (i.e. it will discard any parent folders if it meets a replace-type skin), and will retrieve the options for the current skin. The second one, wedge_cache_css, will go through the folder list built by the former function, and will build the actual CSS file. Performance-wise, it should be exactly the same as before, except that it's cleaner, and that it allows me to override the skeleton right after loading it from the theme. (Hmm, come to think of it... I should probably load the theme's skeleton after the skin's skeleton, to save on processing time... :lol:)
I'd have hoped this would make it easier to merge add_css_file with wedge_cache_css (their code is VERY similar), but it probably won't be possible, because each one has optimizations that the other couldn't use... I still have hope, though :P
Anyway... 'Done'.
Warm is running the modified skeleton, it has the sidebar on the left, but the rest of the content is crammed onto two vertical columns if the main content doesn't take much space (actually, it looks funny.) I guess I'll have to encase all of the content (and header, and footer) into their own div. Well, the structure isn't too great... I should probably add more layers, so that pretty much every block is encased within a special div that I can then manipulate as I wish.
That, or I actually allow adding functions within a file in the skin... Something like 'Custom.template.php', which would be loaded by Wedge at loadTheme time, and would contain overrides, i.e. "template_body_above_override". If such an override exists, Wedge won't run the original function. Of course, then, it's getting closer in spirit to a full-fledged new theme, and I don't know if I'm ready to make that big a jump...
Still got plenty left to do. Hopefully I'll be finished by tomorrow night... I'd really rather not spend too much time on this. I guess I can fix Warm later -- definitely not a priority (heck, I can simply remove the <skeleton> entry in skin.xml just to fix it for now...)
I'd have hoped this would make it easier to merge add_css_file with wedge_cache_css (their code is VERY similar), but it probably won't be possible, because each one has optimizations that the other couldn't use... I still have hope, though :P
Anyway... 'Done'.
Warm is running the modified skeleton, it has the sidebar on the left, but the rest of the content is crammed onto two vertical columns if the main content doesn't take much space (actually, it looks funny.) I guess I'll have to encase all of the content (and header, and footer) into their own div. Well, the structure isn't too great... I should probably add more layers, so that pretty much every block is encased within a special div that I can then manipulate as I wish.
That, or I actually allow adding functions within a file in the skin... Something like 'Custom.template.php', which would be loaded by Wedge at loadTheme time, and would contain overrides, i.e. "template_body_above_override". If such an override exists, Wedge won't run the original function. Of course, then, it's getting closer in spirit to a full-fledged new theme, and I don't know if I'm ready to make that big a jump...
Still got plenty left to do. Hopefully I'll be finished by tomorrow night... I'd really rather not spend too much time on this. I guess I can fix Warm later -- definitely not a priority (heck, I can simply remove the <skeleton> entry in skin.xml just to fix it for now...)
7926
Features / Re: Public & Private Groups?
« on September 7th, 2011, 09:43 PM »
We should add a FAQ entry.
As for board owners, it's not too complex to port from the noisen codebase (topic privacy in comparison will be a chore to do ;))
As for board owners, it's not too complex to port from the noisen codebase (topic privacy in comparison will be a chore to do ;))
7927
Features / Re: Template skeleton!
« on September 7th, 2011, 06:55 PM »OK, idiot question time, because I'm not seeing how the one thing that is quite important to me is covered.
I see there is the sidebar_feed item inside the sidebar. How do I go about adding a new item in sidebar, preferably doing it before sidebar_feed, and doing it dynamically because I don't want it every page?
The skeleton array is generated right from loadTheme(), so basically everything you add to it later (via loadSubTemplate) will be added to the array by Wedge. It'll be transparent...
I can also add a removeSubTemplate() function.
I'll also add something like loadLayer(), although I don't exactly know how it'll work... (i.e. where do we position it?)
BTW, I just found out that there's a slight miscalculation in my project.
The skin.xml override is loaded through wedge_cache_css, which itself is loaded through theme_base_css, which itself is called "at the last possible minute"... Although this works quite well for all of the overrides it has (html blocks, etc.), rebuilding the skeleton at that time will delete all of the existing subtemplates.
Hmm...
Don't really know how to fix that -- except by loading the CSS files twice: once early on for the skeleton override, and once at the last minute for block overrides. Yikes.... :-/
Any idea? I'll take a cigarette break.
7928
Features / Re: Template skeleton!
« on September 7th, 2011, 06:37 PM »I never got the idea behind using default theme for images..
no themes use it, and not many use the based-on option either. Whats important is that the fallback tempaltes are self-contained, so if a custom theme rewrites everything in index.tempalte, possibly display.tempalte, the others would still work.
In the beginning I argued sepatating styles, or at least use alot of common classes. Both was worked out to be one-file-fits all and maybe 10% classes, the rest is id styles.
Heck, even the actual common classes (windowbg*, clear_*, float*...) didn't get used all of the time.
Wasting a lot of good styles on things designers seldom change anyway, making working with index.css a nightmare really.. Its like it was all - or nothing lol.
I'd tend to say -- feel free to simplify the Wedge CSS, reapply things to the HTML and not always the CSS... You can always submit a patch and I'll happily look through it :) I'm all for the simplification of code -- I just can't do it alone because I have more things to do and they're not all layout-related.
Okay, my progress on this...
- Wine is working. Some subtemplates won't show, because I haven't yet converted the 'sub_template'/'template_layers' code to use the array.
- The skeleton override is working. The skeleton is rewritten to fit my HTML tags. Here's the code I put into Warm's skin.xml:
<!--
Layout skeleton. The following uses pseudo-HTML to represent the final array.
- use <tags></tags> to define layers (i.e. a function
called as a wrapper around other functions)
- use <self closing tags /> to define sub-templates
Overrides the theme's $context['skeleton'] variable.
-->
<skeleton>
<html>
<body>
<wrapper>
<sidebar>
<sidebar_feed />
</sidebar>
<header />
<menu />
<linktree />
<top></top>
<main>
<content />
</main>
<footer />
</wrapper>
</body>
</html>
</skeleton>As you can see, it's dead simple... Feel free to suggest any improvements, in case I missed anything. (The indentations are only there for clarity. Obviously they're not needed...)
Also, the rendering for this rewritten skeleton is buggy. It still uses the other one... Uh.
And the db_debug_junk is output at the beginning instead of the end, meaning the body tag closer isn't output at this point. Well, it's probably the kind of bug I'll spend an hour on, until I find out that I made a tiny mistake at one point and spend another hour cursing at myself... :lol:
Posted: September 7th, 2011, 06:35 PM
:edit: db_debug_junk issue fixed...
7929
Features / Re: Help page as FAQ page
« on September 7th, 2011, 02:41 PM »
I think we can at least safely say that a documentation project for Wedge is underway. It's pretty basic for now but it'll serve as a basis for more. The project is currently being held by Norodo from the forum :)
7930
Features / Re: Public & Private Groups?
« on September 7th, 2011, 09:36 AM »
Btw. User owned boards aren't implemented in Wedge yet. Only in wedge.org and noisen.com (not the same codebase at all).
It's in my to-do for 1.0 though. But it probably won't be in the alpha except for the id_owner field being created.
It's in my to-do for 1.0 though. But it probably won't be in the alpha except for the id_owner field being created.
7931
Features / Re: Template skeleton!
« on September 7th, 2011, 09:25 AM »
I'd just tend to have this philosophy: don't waste CPU cycles fixing crap made by badly coded mods or themes.
Btw I also tend to forget to update your documentation when I remove stuff hehe. For instance it referred to include_after_template which doesn't even exist anymore so I removed it ;)
I guess that, somehow, the tempting system could use a diet. Like so many other things you already did!
Btw - use default images AND templates? That's skin territory to me ;)
Btw I also tend to forget to update your documentation when I remove stuff hehe. For instance it referred to include_after_template which doesn't even exist anymore so I removed it ;)
I guess that, somehow, the tempting system could use a diet. Like so many other things you already did!
Posted: September 7th, 2011, 09:23 AM
Btw - use default images AND templates? That's skin territory to me ;)
7932
Features / Re: Template skeleton!
« on September 7th, 2011, 12:01 AM »
I'd tend to say, 'screw mods if they're not gonna behave'... :P
I'm doing my best to ensure they'll have an easier time, so they'd better not piss me off :niark:
Okay, in template_footer() (now finish_output(), although it may be going away at some point), I have this:
* - Theme dirs and paths are re-established from the master values (as opposed to being modified through any other page)
It's in your comment, Pete.
So, are you sure this is what the code does? I'd tend to say yes, but... What's the point, really?
I mean, why would a mod modify the theme URL right in the middle of the page? Did SMF implement that after they noticed the variable being abused?
Apart from that... It's a little buggy, but my implementation seems to work fine, at least on regular pages.
SMF added tons of hacks to the layer system. I'm gonna have to trust them and include them in my own, but... meh.
The rest will come tomorrow...
I'm doing my best to ensure they'll have an easier time, so they'd better not piss me off :niark:
Okay, in template_footer() (now finish_output(), although it may be going away at some point), I have this:
* - Theme dirs and paths are re-established from the master values (as opposed to being modified through any other page)
It's in your comment, Pete.
So, are you sure this is what the code does? I'd tend to say yes, but... What's the point, really?
I mean, why would a mod modify the theme URL right in the middle of the page? Did SMF implement that after they noticed the variable being abused?
Apart from that... It's a little buggy, but my implementation seems to work fine, at least on regular pages.
SMF added tons of hacks to the layer system. I'm gonna have to trust them and include them in my own, but... meh.
The rest will come tomorrow...
7933
Features / Re: Template skeleton!
« on September 6th, 2011, 09:59 PM »
Great. I'll try to implement that tonight or tomorrow. :)
Mod compatibility with what? SMF? Well, it won't be the first rewrite they'll have to go through... ;)
Mod compatibility with what? SMF? Well, it won't be the first rewrite they'll have to go through... ;)
7934
Features / Re: Template skeleton!
« on September 6th, 2011, 08:09 PM »
Okay... Busy IRL, but the more I think about it, the more it strikes me as relatively simple.
To hell with template layers as such.
A template system should have this kind of structure, which can *easily* be replicated in a pseudo-XML file, and thus overridden through skin.xml:
Code: [Select]
Or (sidebar in the left side)
Code: [Select]
And there you go...
The idea, as you can see, is that a layer is just an array. Multiple nested arrays means multiple layers. If we go through the layers recursively, each time we meet an array, we take its key, and then test for "template_KEY_above", if there, we call it. Then we go through the array and call its subtemplates (I added random keys and values, which we use can be discussed, and the other can be used for something else), until we meet an array etc, and then when the loop is over, we just test for "template_KEY_below", and if there, we call it...
You can easily add sub-templates to any of the systems by calling a custom insert function we'll provide -- said function will simply look recursively for the 'layer' we want, and add the stuff there, or it could even add a subtemplate before or after another, etc...
It's a bit harder to remove layers for this but again -- it's just an array, it's easily to manipulate. We can have a function for that, too, we can basically keep the structure inside a layer while removing said layer. We can remove everything and just rebuild a barebones template with hideChrome(), etc...[1]
This way, we can also easily add layers that aren't in the theme. We can also add layers in the theme that have no above and below functions -- we can leave it up to a mod to add them... (Although they could also use the override hook for that. I don't think I implemented it for layers, though...)
Anyway. It's a whole new world to me, suddenly... And quite exciting. I really like the idea of having a basic structure that can be modified by a skin. All extra layers and subtemplates added by mods and such should add their stuff relative to the existing skeleton -- e.g. if they want to add a sidebar subtemplate, they'll just call a function that searches for the 'sidebar' array and then adds their subtemplate entry to it.
What do you think, guys...?
(Edited to differentiate between the two sidebar layouts. The wrapper layer is just that extra div which is made into a table and allows us to have a sidebar that behaves like a table cell i.e. it takes the entire height...)
To hell with template layers as such.
A template system should have this kind of structure, which can *easily* be replicated in a pseudo-XML file, and thus overridden through skin.xml:
$templates = array(
'html' => array(
'body' => array(
'header' => 'header',
'menu' => 'menu',
'nav' => 'linktree',
'wrapper' => array(
'sidebar' => array(
'rss' => 'rss_feed',
),
'top' => array(
'subtemplate1' => 'subtemplate1',
),
'main' => array(
'content' => 'subtemplate1',
),
),
'footer' => array(
'sub1' => 'wedge_credits',
'sub2' => 'my_mod_credits',
),
),
),
);Or (sidebar in the left side)
$templates = array(
'html' => array(
'body' => array(
'wrapper' => array(
'sidebar' => array(
'rss_feed',
),
'header',
'menu',
'linktree',
'top' => array(
'subtemplate1',
),
'main' => array(
'content',
),
'footer' => array(
'wedge_credits',
'my_mod_credits',
),
),
),
),
);And there you go...
The idea, as you can see, is that a layer is just an array. Multiple nested arrays means multiple layers. If we go through the layers recursively, each time we meet an array, we take its key, and then test for "template_KEY_above", if there, we call it. Then we go through the array and call its subtemplates (I added random keys and values, which we use can be discussed, and the other can be used for something else), until we meet an array etc, and then when the loop is over, we just test for "template_KEY_below", and if there, we call it...
You can easily add sub-templates to any of the systems by calling a custom insert function we'll provide -- said function will simply look recursively for the 'layer' we want, and add the stuff there, or it could even add a subtemplate before or after another, etc...
It's a bit harder to remove layers for this but again -- it's just an array, it's easily to manipulate. We can have a function for that, too, we can basically keep the structure inside a layer while removing said layer. We can remove everything and just rebuild a barebones template with hideChrome(), etc...[1]
This way, we can also easily add layers that aren't in the theme. We can also add layers in the theme that have no above and below functions -- we can leave it up to a mod to add them... (Although they could also use the override hook for that. I don't think I implemented it for layers, though...)
Anyway. It's a whole new world to me, suddenly... And quite exciting. I really like the idea of having a basic structure that can be modified by a skin. All extra layers and subtemplates added by mods and such should add their stuff relative to the existing skeleton -- e.g. if they want to add a sidebar subtemplate, they'll just call a function that searches for the 'sidebar' array and then adds their subtemplate entry to it.
What do you think, guys...?
Posted: September 6th, 2011, 08:07 PM
(Edited to differentiate between the two sidebar layouts. The wrapper layer is just that extra div which is made into a table and allows us to have a sidebar that behaves like a table cell i.e. it takes the entire height...)
| 1. | Note for later: remove the sidebar hack from hideChrome... |
7935
Features / Re: New revs
« on September 6th, 2011, 07:42 PM »
rev 984
(2 files, 5kb)
* Small extra jQuery conversion. (ManageServer.php)
! Syntax error. (Aeva-Embed.php)
(It's not much, but I modified many files for the templating stuff and I'm trying to keep the 'other' files out of my way...)
(2 files, 5kb)
* Small extra jQuery conversion. (ManageServer.php)
! Syntax error. (Aeva-Embed.php)
(It's not much, but I modified many files for the templating stuff and I'm trying to keep the 'other' files out of my way...)