-2

Here's the result what I need to get. These images will be used for js slide.

<ul id="show" class="pic">

    <li><span><a href='javascript:void(0);'><img src='images/1.jpg'  rel='images/1.jpg'></a></span></li>
    <li><span><a href='javascript:void(0);'><img src='images/2.jpg'  rel='images/1.jpg'></a></span></li>
    <li><span><a href='javascript:void(0);'><img src='images/3.jpg'  rel='images/1.jpg'></a></span></li>
    <li><span><a href='javascript:void(0);'><img src='images/4.jpg'  rel='images/1.jpg'></a></span></li>

  </ul>

So I used the code followed to render DOM. But it doesn't work correctly.

   `<ul id="show" class="pic"> </ul>
   <script type = "text/template" id="tpl">

   <%    
    for(var i = 0; i < data2.list.length; i++) { 
        var item = data2.list[i] %>

    <li><span><a href='javascript:void(0);'><img src='<%= item.slide %>'  rel='<%= item.slide %>'></a></span></li>
    <% } %>

</script>

`

Donny
  • 94
  • 6

1 Answers1

1

Backbone JS executes on the client side, and therefore must be sent to the browser. PHP executes on the server so is never sent to the browser. There is a fundamental difference in client-side and server-side code, I'd suggest you do some background reading around it.

The only thing you can do to help hide the code is to obfuscate or minify your javascript files, using a tool like uglify. This would need to be built into your build process.

Ben
  • 1,767
  • 16
  • 32