Skip to content

Instantly share code, notes, and snippets.

@Tim-Machine
Last active August 29, 2015 13:57
Show Gist options
  • Save Tim-Machine/9620501 to your computer and use it in GitHub Desktop.
Save Tim-Machine/9620501 to your computer and use it in GitHub Desktop.
<!-- fires blog-entries event, limit is a param being passed on the even. All the template logica would be
handeled in the blog-entries handler.
-->
<div id="blog" data-simplex="blog-entries" data-limit="20">
<div class="entry">
<!-- append author name to end of string would return `Written by: Tim-Machine` -->
<div class="blog_author" data-var="author_name" data-placement="append">Written by: </div>
<!-- replace `date` with the correcly formatted dynamic date -->
<div class="blog_postDate" data-var="pub_date" data-placement="replace{date}" data-format="m-d-Y" >date</div>
<!-- replace `content` with dynamic content while leaving the paragraph tags in place-->
<div class="content" data-var="content" data-placement="replace{content}">
<!-- any variable avaiable in this scope is avaiable if its wrapped in curley brackets -->
<div id="blog_img" data-simplex="if" data-statment="image != '' ">
<img src="{image}" />
</div>
<p>content</p>
</div>
</div>
</div>
@pdougall1
Copy link

Loop?

names_array = ['dougs', 'tim', 'michael']

<ul data-var='names_array'  data-simplex='loop-over'>
  // somehow pass name in here?
  <li> data-simplex='name'</li>
</ul>

@Tim-Machine
Copy link
Author

<ul data-simplex="foreach" data-var="names_array" data-as="name">
  <li data-var="name" data-replay="name">name</li>
</ul>

@pdougall1
Copy link

rendering html from a different file?

<%= render partial 'dir/form_stuff' %>

@Tim-Machine
Copy link
Author

Depends on how you want to do it,

<!-- as an include  (assuming a theming dir has been configured )-->
<div data-silex="include" data-file="dir/form_stuff.html"> </div>

Need clean way to do this with out the data-simplex designator also.

{simplex:include file="dir/formstuff.html"}

This could work but my goal is to keep the HTML as clean as possible

@pdougall1
Copy link

righteo, looks pretty good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment