Loading ...
Sorry, an error occurred while loading the content.
 

[Cheetahtemplate-discuss] Problem with Templating ... I'm new....

Expand Messages
  • Benjamin Schollnick
    Folks, I m starting out with Cheetah, and while I have had some success... I m having an issue with Filters... 1) I need to be able to restrict the output to
    Message 1 of 3 , Jun 21, 2011
      Folks,
      
      I'm starting out with Cheetah, and while I have had some success... I'm
      having an issue with Filters...
      
      1) I need to be able to restrict the output to let's say 5 characters, and this doesn't seem to work..
      
                <TD>${idevice_list[$idevice]["battery"], maxlen=5}</td>
      
      2) the $insert_map_js needs to be unfiltered, it appears to be changed
      inside of cheetah's tempting to be "web safe".  I have tried :
      
                                ${insert_map_js, raw)
      
      and receive an error, that raw is unknown.  I've tried #raw & #end raw,
      but that doesn't seem to work...  Any suggestions?  I believe I have the syntax right...  Any assistance would be appreciated.
      
               - Benjamin
      
      
      ---Template ---
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
          <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
      <link rel="stylesheet" type="text/css" href="css/Find-my-iDevices.css">
      <title>Find my iDevices</title>
      $insert_map_js
      </Head>
      
        <body onload="load()" onunload="GUnload()">
      <table Border=1>
      <TD><B>Name of iDevice</B></td>
      <TD><B>iDevice Type</B></td>
      <TD><B>Revision</B></td>
      <TD><B>Charging Status</B></td>
      <TD><B>Battery Level</B></td>
      <TD><B>Latitude</B></td>
      <TD><B>Longitude</B></td>
      <TD><B>Accuracy</B></td>
      </tr><TR>
      #for $idevice in $idevice_list
      <tr><TD>$idevice</TD>
      <TD>$idevice_list[$idevice]["class"]</td>
      <TD>$idevice_list[$idevice]["deviceModel"]</td>
      <TD>$idevice_list[$idevice]["charging"]</td>
      <TD>${idevice_list[$idevice]["battery"], maxlen=5}</td>
      <TD>$idevice_list[$idevice]["location"]["latitude"]</td>
      <TD>$idevice_list[$idevice]["location"]["longitude"]</td>
      <TD>$idevice_list[$idevice]["location"]["accuracy"]</td>
      </TR>
      #end for
      </table>
      <hr>
          <div id="map" style="width: 1000px; height: 600px"></div>
      </body>
      

    • James Abbatiello
      Have you tried ${idevice_list[$idevice][ battery ][0:5]} ? I don t know what might be causing your other problem. Are you sure that something else isn t
      Message 2 of 3 , Jun 21, 2011
        Have you tried ${idevice_list[$idevice]["battery"][0:5]} ?

        I don't know what might be causing your other problem.  Are you sure that something else isn't escaping it before it gets to Cheetah?

        --
        James Abbatiello


        On Tue, Jun 21, 2011 at 2:39 PM, Benjamin Schollnick <benjamin@...> wrote:
        Folks,
        
        I'm starting out with Cheetah, and while I have had some success... I'm
        having an issue with Filters...
        
        1) I need to be able to restrict the output to let's say 5 characters, and this doesn't seem to work..
        
                  <TD>${idevice_list[$idevice]["battery"], maxlen=5}</td>
        
        2) the $insert_map_js needs to be unfiltered, it appears to be changed
        inside of cheetah's tempting to be "web safe".  I have tried :
        
                                  ${insert_map_js, raw)
        
        and receive an error, that raw is unknown.  I've tried #raw & #end raw,
        but that doesn't seem to work...  Any suggestions?  I believe I have the syntax right...  Any assistance would be appreciated.
        
                 - Benjamin
        
        
        ---Template ---
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
          <head>
            <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <link rel="stylesheet" type="text/css" href="css/Find-my-iDevices.css">
        <title>Find my iDevices</title>
        $insert_map_js
        </Head>
        
          <body onload="load()" onunload="GUnload()">
        <table Border=1>
        <TD><B>Name of iDevice</B></td>
        <TD><B>iDevice Type</B></td>
        <TD><B>Revision</B></td>
        <TD><B>Charging Status</B></td>
        <TD><B>Battery Level</B></td>
        <TD><B>Latitude</B></td>
        <TD><B>Longitude</B></td>
        <TD><B>Accuracy</B></td>
        </tr><TR>
        #for $idevice in $idevice_list
        <tr><TD>$idevice</TD>
        <TD>$idevice_list[$idevice]["class"]</td>
        <TD>$idevice_list[$idevice]["deviceModel"]</td>
        <TD>$idevice_list[$idevice]["charging"]</td>
        <TD>${idevice_list[$idevice]["battery"], maxlen=5}</td>
        <TD>$idevice_list[$idevice]["location"]["latitude"]</td>
        <TD>$idevice_list[$idevice]["location"]["longitude"]</td>
        <TD>$idevice_list[$idevice]["location"]["accuracy"]</td>
        </TR>
        #end for
        </table>
        <hr>
            <div id="map" style="width: 1000px; height: 600px"></div>
        </body>
        


        ------------------------------------------------------------------------------
        EditLive Enterprise is the world's most technically advanced content
        authoring tool. Experience the power of Track Changes, Inline Image
        Editing and ensure content is compliant with Accessibility Checking.
        http://p.sf.net/sfu/ephox-dev2dev
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


      • Benjamin Schollnick
        ... No I didn t. Thank you, I believe that should work, I keep forgetting that Cheetah is a Python based tagging system, so it respects the Python rules...
        Message 3 of 3 , Jun 22, 2011

          On Jun 22, 2011, at 1:17 AM, James Abbatiello wrote:

          Have you tried ${idevice_list[$idevice]["battery"][0:5]} ?

          No I didn't.  Thank you, I believe that should work, I keep forgetting that Cheetah is a Python based tagging system, so it respects the Python rules...

          I don't know what might be causing your other problem.  Are you sure that something else isn't escaping it before it gets to Cheetah?

          I found a work around, but I don't know if it's the best answer...

          #include raw source=$insert_map_js

          Here's to some more research...  So far, Cheetah is quite useful and powerful.... 

          - Benjamin


        Your message has been successfully submitted and would be delivered to recipients shortly.