Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo executable code needed #19

Open
jasonrgd opened this issue Sep 21, 2015 · 1 comment
Open

Demo executable code needed #19

jasonrgd opened this issue Sep 21, 2015 · 1 comment
Labels

Comments

@jasonrgd
Copy link

it would be nice to have some form of demo code which can be directly executed on download.

@jasonrgd jasonrgd changed the title Can someone put in demo executable code Demo executable code needed Sep 21, 2015
@qfox
Copy link
Member

qfox commented Sep 21, 2015

Something like this?

require('vendor/bem/bh/index.php');
$bh = new BEM/BH();
$bh->match('type1', function ($ctx, $json) {
  $ctx->tag('button');
});
$bh->match('type2', function ($ctx, $json) {
  $ctx->attrs(['id' => 12]);
});
echo $bh->apply([
  ['block' => 'type1'],
  ['block' => 'type2'],
]);
// will render: <button class="type1"></button><div class="type2" id="12"></div>

@qfox qfox added the question label Sep 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants