AW: [SMARTY] counting
| From: | Mario Deutschmann | Date: | Fri, 12 Jul 2002 12:24:22 +0000 |
| Subject: | AW: [SMARTY] counting | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5264@lists.php.net to get a copy of this message | ||
hi!
imho it's better to send the primary key ('adid' i guess) as the value of
the checkbox, because someone could add a row in the meanwhile
you read the list... after pressing "delete" button, the form would delete
the wrong rows.
my suggestion:
<input type="checkbox" name="checkbox{counter}"
value="{$ids[searchresults].adid}">
---------------------------------------------------------------------
btw: i have another question for this scenario (displaying mysql
result-list):
i'm gonna develope a template where i don't know whether the designer need
the result-rows of my sql-query. i dont' wanna execute the sql-query if
there's no need. how i can do this? creating an own block?
if i use a "section" the query is qlways executed when i make the assign to
smarty-template.
any ideas?
bye
mario)
btw: i'm new to this list and my english is awful, but maybe someone
understand my question... <o)
> -----Ursprungliche Nachricht-----
> Von: Monte Ohrt [mailto:monte@ispi.net]
> Gesendet: Freitag, 12. Juli 2002 05:32
> An: Blue Presley
> Cc: smarty-general@lists.php.net
> Betreff: Re: [SMARTY] counting
>
>
> oh, and to answer your question on counting, there is a
> function called
> counter that comes with Smarty that will do what you want.
>
> <input type="checkbox" name="checkbox{counter}"
> value="checkbox">
>
>
>
> Blue Presley wrote:
>
> >hello. I am using {section} to loop through mysql results
> and display them
> >as rows in a table. I have a check box in the far right
> column of each
> >dynamically generated row so that people can select which
> rows they would
> >like to delete. in order to properly delete the checked
> item, I need to
> >individualize the checkbox names. I currently have it set
> up like this:
> >
> >{section name=searchresults loop=$ids}
> > <tr>
> > <td><input type="checkbox" name="checkbox{$ids|count}"
> >value="checkbox"></td>
> > <td height="30">{$ids[searchresults].postdate}</td>
> > <td ><a
> >href="jobdetails.php?ID={$ids[searchresults].adid}">{$ids[sea
> rchresults].adt
> >itle}</a></td>
> > <td >{$ids[searchresults].location}</td>
> > <td >{$ids[searchresults].companyname}</td>
> > </tr>
> > {/section}
> >
> >please notice the {ids|count}. I was hoping this would
> generate a new
> >number for each loop and, voila, a different name for each
> checkbox. of
> >course the numbering should correspond to the number of
> elements in the $ids
> >array. I'm not getting the results i want. I guess I'm
> confused as to how
> >the count property works
> >
> >so how do I do it to make it count and give each checkbox
> it's on name?
> >(checkbox1, checkbox2, etc)
> >
> >thanks
> >blue
> >
> >
> >
> >
>
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>