<div dir="ltr">This is not a Sugar development question. <div>If you are using a specific tool (like HandleBars) and have a problem,</div><div>you should go to the specific tool forum to ask questions.</div><div><br></div><div>And maybe you are not using the right tool for the job.</div><div><br></div><div>Gonzalo</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 25, 2015 at 11:34 PM, utkarsh Dhawan <span dir="ltr"><<a href="mailto:dhawanutkarsh@gmail.com" target="_blank">dhawanutkarsh@gmail.com</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">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 style="white-space:pre-wrap">            </span>{{#each this}}</div><div><span style="white-space:pre-wrap">                                   </span><li></div><div><span style="white-space:pre-wrap">                                               </span><h2>{{Title}}</h2></div><div><span style="white-space:pre-wrap">                                           </span>{{#if content}}</div><div><span style="white-space:pre-wrap">                                                  </span><p>{{{content}}}</p></div><div><span style="white-space:pre-wrap">                                         </span>{{/if}}</div><div><span style="white-space:pre-wrap">                                          </span>{{#if code}}</div><div><span style="white-space:pre-wrap">                                             </span><div class="code">{{code}}</div></div><div><span style="white-space:pre-wrap">                                           </span>{{/if}}</div><div><span style="white-space:pre-wrap">                                          </span><button onclick="previous()">Previous</button></div><div><span style="white-space:pre-wrap">                                             </span><button onclick="next()">Next</button></div><div><span style="white-space:pre-wrap">                                     </span></li></div><div><span style="white-space:pre-wrap">              </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 style="white-space:pre-wrap">               </span>(function(){</div><div><span style="white-space:pre-wrap">                     </span>var data=[{</div><div><span style="white-space:pre-wrap">                              </span>id:"0",</div><div><span style="white-space:pre-wrap">                                </span>Title:"Diving In",</div><div><span style="white-space:pre-wrap">                             </span>content:"Some Data.",</div><div><span style="white-space:pre-wrap">                  </span>},{</div><div><span style="white-space:pre-wrap">                              </span>id:"1",</div><div><span style="white-space:pre-wrap">                                </span>Title:"Text Editor",</div><div><span style="white-space:pre-wrap">                           </span>content:"Some Data"</div><div><span style="white-space:pre-wrap">                    </span>}];</div><div><span style="white-space:pre-wrap">                      </span>var template=Handlebars.compile( $('#template').html() );</div><div><span style="white-space:pre-wrap">                        </span>$('ul.content').append(template(data));</div><div><span style="white-space:pre-wrap">          </span>})();<span style="white-space:pre-wrap">           </span></div><div><span style="white-space:pre-wrap"> </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"><span class=""><br clear="all"><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>
<br></span><div><div class="h5"><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>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><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><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></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Gonzalo Odiard<br><br><div>SugarLabs - Software for children learning <br></div></div></div>
</div>