<div dir="ltr">Hi Gonzalo,<div><br></div><div>Ya I would try to be more explanatory this time.</div><div><br></div><div>My code looks somewhat like this:</div><div><br></div><div><script id="template" type="text/x-handlebars-template"></div><div><span class="" style="white-space:pre"> </span>{{#each this}}</div><div><span class="" style="white-space:pre"> </span><li></div><div><span class="" style="white-space:pre"> </span><h2>{{Title}}</h2></div><div><span class="" style="white-space:pre"> </span>{{#if content}}</div><div><span class="" style="white-space:pre"> </span><p>{{{content}}}</p></div><div><span class="" style="white-space:pre"> </span>{{/if}}</div><div><span class="" style="white-space:pre"> </span>{{#if code}}</div><div><span class="" style="white-space:pre"> </span><div class="code">{{code}}</div></div><div><span class="" style="white-space:pre"> </span>{{/if}}</div><div><span class="" style="white-space:pre"> </span><button onclick="previous()">Previous</button></div><div><span class="" style="white-space:pre"> </span><button onclick="next()">Next</button></div><div><span class="" style="white-space:pre"> </span></li></div><div><span class="" style="white-space:pre"> </span>{{/each}}</div><div></script> </div><div><br></div><div>and I send data to this code through HandleBars</div><div><br></div><div><div><script type="text/javascript"></div><div><span class="" style="white-space:pre"> </span>(function(){</div><div><span class="" style="white-space:pre"> </span>var data=[{</div><div><span class="" style="white-space:pre"> </span>id:"0",</div><div><span class="" style="white-space:pre"> </span>Title:"Diving In",</div><div><span class="" style="white-space:pre"> </span>content:"Some Data.",</div><div><span class="" style="white-space:pre"> </span>},{</div><div><span class="" style="white-space:pre"> </span>id:"1",</div><div><span class="" style="white-space:pre"> </span>Title:"Text Editor",</div><div><span class="" style="white-space:pre"> </span>content:"Some Data"</div><div><span class="" style="white-space:pre"> </span>}];</div><div><span class="" style="white-space:pre"> </span>var template=Handlebars.compile( $('#template').html() );</div><div><span class="" style="white-space:pre"> </span>$('ul.content').append(template(data));</div><div><span class="" style="white-space:pre"> </span>})();<span style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span></script></div></div><div><br></div><div>Now I just want the content and title to be displayed according to their ids or something(only one at a time),but since the HandleBars is logic-less I am not sure how to do that.</div><div><br></div><div>So when the user clicks next the content and title of id 1 should be displayed and when previous the content and title of id 0 should be displayed dynamically.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div style="font-size:small">Thanking You,</div><div style="font-size:small">Utkarsh Dhawan</div><div style="font-size:small">(Developer/Student)</div><div style="font-size:small"><br></div><div style="font-size:small">Note:Please Consider The environment before printing.</div></div></div></div>
<br><div class="gmail_quote">On Fri, Jun 26, 2015 at 1:42 AM, Gonzalo Odiard <span dir="ltr"><<a href="mailto:godiard@sugarlabs.org" target="_blank">godiard@sugarlabs.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You don't describe the problems.<div>Please explain and if possible point to the code or examples.</div><div><br></div><div>Gonzalo</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Jun 25, 2015 at 1:30 PM, utkarsh Dhawan <span dir="ltr"><<a href="mailto:dhawanutkarsh@gmail.com" target="_blank">dhawanutkarsh@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>I am working on a Sugar Activity called WebConfusion.It is basically a python webkit activity which displays HTML page in it.I am currently templating the webpages using the Handlebars js.Now the aim of the activity is to show texts on various topics of HTML,CSS and JavaScript.I want to dynamically load content on the page and add next and previous button to it which load the next js object on the same page dynamically.Although Roshan Poduyal helped me out but still I am facing problems and I guess he is not available now.Hope to recieve some guidance.</div><div><br></div><div><div><div><div dir="ltr"><div style="font-size:small">Thanking You,</div><div style="font-size:small">Utkarsh Dhawan</div><div style="font-size:small">(Developer/Student)</div><div style="font-size:small"><br></div><div style="font-size:small">Note:Please Consider The environment before printing.</div></div></div></div>
</div></div>
<br></div></div>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" rel="noreferrer" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr">Gonzalo Odiard<br><br><div>SugarLabs - Software for children learning <br></div></div></div>
</font></span></div>
</blockquote></div><br></div>