Re: Using a variable for a dataset

"snarmont" <[email protected]>
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
--- In [email protected], "Gabe Phan" <blakey_4@...> wrote:
>
> I want to be able to use a variable to access a dataset.  For example
> in the following code, I want 'User' to be a variable (ie. User = Joe,
> Bob, etc).
> 
> <?cs set:User=Query.user ?>
> 
> <?cs each:item=User.setting ?>
> 
>  <?cs #Do something here ?>
> 
> <?cs /each ?>
>


You might try creating a macro, then pass the variable into that macro:

<?cs def:do_something(target) ?>

    <?cs each:item=target.setting ?>
       <?cs ### DO SOMETHING HERE ?>
    <?cs /each ?>

<?cs /def ?>


<?cs call:do_something(Query.User) ?>


See:

http://www.clearsilver.net/docs/man_macros.hdf


--
Steve Narmontas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.