[thelist] Secure FTP

Maximillian Schwanekamp lists at neptunewebworks.com
Wed Jul 6 13:17:02 CDT 2005


Jonathan wrote:
> Dude, KISS.  I would install OpenSSH (guide here:
> http://pigtail.net/LRP/printsrv/cygwin-sshd.html), and then use WinSCP
> (www.winscp.com) as a client. 

Hey thanks for the mention of WinSCP.  I'd been using Filezilla for FTP,
and the SFTP on FZ is strangely slow and apparently buggy in my
experience.  WinSCP makes secure FTP via SSH a no-brainer.


<tip type="Foreach loops in Smarty PHP templates" author="Max Schwanekamp">
The Foreach loop is one of the simpler --and more powerful-- tools on
the presentation side of the Smarty template engine.  It can be used to
easily loop over either indexed or associative arrays (contrary to what
the docs seem to imply), and can be nested to reach deep arrays.

One seeming drawback is that the "total" property of the foreach can
only be used within or after the foreach.  One way around this is to put
the foreach inside a {capture} first.  Then presentationally speaking
you can use the foreach.total property *before* the foreach, making
presentational logic decisions, etc.  Simple example:

{* put the loop output into a variable *}
{capture assign="item_rows"}
{foreach from="cart_items" item="item" name="itemsloop"}
<tr>
  <td>{$item.name}</td>
  <td>{$item.price}</td>
</tr>
{/foreach}
{/capture}

{* use the smarty.foreach obj to get the "total" property *}
<p>You have {$smarty.foreach.itemsloop.total} items in your cart.</p>
<table><caption>Cart Contents</caption>
<tr>
  <th scope="col">Item Name</th>
  <th scope="col">Item Price</th>
</tr>
{* output the loop *}
{$item_rows}
</table>

</tip>

-- 
Max Schwanekamp http://www.neptunewebworks.com/



More information about the thelist mailing list