1
DonXoop
Using smarty code in PHP

I'm sure this is a simple thing but my brain must be tired.
I have some db queries I put in the TinyD module as PHP scripts. The scripts work great but now I'd like to cycle the row colors like many blocks do.

Instead of a simple
<tr>
I'd like to do something like:
<tr class="<{cycle values="even,odd"}>">


In other words I have a line like:
echo "<tr>";
but I'd like to use the cycle function in the tr.

I need to use PHP as the code type because of all the db queries (that part works fine).

2
skalpa
Re: Using smarty code in PHP
  • 2005/5/16 22:34

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


1) About "using smarty code in PHP"
Forget about it. Anyway, this is not your real problem, just a wrong solution

2)
$values = array( 'odd''even' );
$idx 0;
while (
$loop) {
    echo 
"<tr class='{$values[$idx]}'>";
    
$idx $idx++ % count($values);  // Replace with "2" if possible
    
....
}

3
DonXoop
Re: Using smarty code in PHP

Thank you!
That was the hint I needed to make it work. Thanks again.

Login

Who's Online

177 user(s) are online (101 user(s) are browsing Support Forums)


Members: 0


Guests: 177


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits