Welcome Guest, Not a member yet? Register   Sign In
Bucket: Another layout and asset library
#1

[eluser]backstack[/eluser]
Hey everyone,

I just released the alpha of Bucket, my layout and asset library.

Go to it's project page for a rundown and documentation, or to Github for the code. Smile

EDIT:

I'll pop in a few usage examples for us lazy people. Smile

Setting layout and content:
Code:
$this->bucket->set_layout_id('desktop/main');
$this->bucket->set_content_id('users/user');

Adding data:
Code:
$this->bucket->add_data('user', $user);

Adding assets:
Code:
$this->bucket->add_css('reset', array('combine' => FALSE, 'cache' => FALSE, 'attributes' => array('media' => 'screen')));
$this->bucket->add_css('ie6', array('group' => 'ie'));
$this->bucket->add_css('ie7', array('group' => 'ie'));
$this->bucket->add_js('analytics', array('group' => 'bottom'));

Rendering assets:
Code:
<?= get_css('ie'); ?>
<?= get_js('bottom'); ?>

<?= js('jquery', array('cache' => FALSE)); ?>
<?= img('users/user-175.png'); ?>

Rendering partials:
Code:
<?= render_partial('users/top_users', array('users' => $users));
#2

[eluser]Bainzy[/eluser]
from what i can see this looks good Smile i will take a good look at it later on a fresh install and have a play... good job Smile
#3

[eluser]backstack[/eluser]
[quote author="Bainzy" date="1285680713"]from what i can see this looks good Smile i will take a good look at it later on a fresh install and have a play... good job Smile[/quote]

Thanks, Bainzy. There's also a couple of example applications in the Github repo too - one's on a 1.7.2 install and another more advanced one (it has a hook that does some magic layout setting and content setting and such) is on the dev-2.0 branch.
#4

[eluser]ammonkc[/eluser]
Looks really nice. I'll have to play around with it on the next project I start. Can the asset management be used without the layout part? I just started using Jammie Rumbelow's custom controller class, and like how it handles the layout.
#5

[eluser]backstack[/eluser]
[quote author="ammonkc" date="1285817115"]Looks really nice. I'll have to play around with it on the next project I start. Can the asset management be used without the layout part? I just started using Jammie Rumbelow's custom controller class, and like how it handles the layout.[/quote]

Thanks!

Using the asset system without the layout should work just fine: you'll want to use the render_assets_tags() library method in your controller to output the asset tags that you have added (using add_asset(), add_css(), or add_js()), or the get_asset() helper functions in your view.
#6

[eluser]ideogroup[/eluser]
Hi Sheldon, great work!

Two questions:

1) Using Bucket I don't know why but my layouts are rendered also if I don't call

$this->bucket->render_layout();

If I call this they are rendered twice.

My code is simple:
$this->bucket->set_layout_id('mylayout');
$this->bucket->set_content_id('login');

2) Is it possible (in some way) to use Codeigniter Template Parser Class (or other) (http://ellislab.com/codeigniter/user-gui...arser.html) with Bucket?

3) What are the differences between /content and /partials dirs?

Thanks
Thomas
#7

[eluser]backstack[/eluser]
Thank you. Smile

1) I'm not sure off-hand why this would be happening - there's a failsafe within Bucket that prevents layout from being output more than once, so perhaps you are telling CodeIgniter somewhere else to echo the same view.

2) As of right now, nope. You could likely modify render_layout() directly if you want to achieve this functionality.

3) The /content directory is specifically for full-page content that typically won't be used more than once. Partials, on the other hand, are usually smaller pieces of code that are used multiple times within a site on multiple content (e.g., a box that lists the most active users, or newest widgets you're selling, or a simple welcome message).
#8

[eluser]Toddish[/eluser]
Hey,

Great library, I started using it today.

I've had a little trouble with it though.

A lot of the documentation is incorrect (wrong methods, e.g. get_content doesn't exist, you say add a route but don't say what), so it's been tricky to implement easily. Plus, the documentation/source doesn't set you up for the asset minifying at all (it needs layout/assets/index.php plus the content one). It's not so bad if you use the advanced example, but if you go straight off the source/basic example you're screwed unless you inspect the code closely. It's confusing because minifying seems to be inbuilt, yet it's such a pain to set up because the default files for it just aren't there.

If you improved the documentation and gave a decent default source that is complete, this library would be perfect. As it is, it is great and works really well, just a pain to set up.
#9

[eluser]backstack[/eluser]
[quote author="Toddish" date="1290487417"]Hey,

Great library, I started using it today.

I've had a little trouble with it though.

A lot of the documentation is incorrect (wrong methods, e.g. get_content doesn't exist, you say add a route but don't say what), so it's been tricky to implement easily. Plus, the documentation/source doesn't set you up for the asset minifying at all (it needs layout/assets/index.php plus the content one). It's not so bad if you use the advanced example, but if you go straight off the source/basic example you're screwed unless you inspect the code closely. It's confusing because minifying seems to be inbuilt, yet it's such a pain to set up because the default files for it just aren't there.

If you improved the documentation and gave a decent default source that is complete, this library would be perfect. As it is, it is great and works really well, just a pain to set up.[/quote]

Thanks for the reply, Toddish. Sorry that you've been having trouble!

I'll make some time to look into it later this week and put an update on Github.
#10

[eluser]backstack[/eluser]
Bucket's been updated to v.0.1.1.

The 'source' directory no longer contains any implementation-specific files.
Instead, the 'implementation' directory should contain everything you need to get started quickly and easily.
The 'basic' example has been updated to include asset rendering functionality.
And some documentation issues have been corrected.

Thanks again for your help, Toddish.




Theme © iAndrew 2016 - Forum software by © MyBB