Author Topic: PHP Help - Consecutive Numbering  (Read 1011 times)

CMYKreative

  • Jr. Member
  • **
  • Posts: 71
    • CMYKreative - Bangkok-based Advertising, Marketing, Graphic Design, Website Design & Development, Brand Identity, Logo Design, Search Engine Optimization (SEO), Hosting, Programming, Photography and Powerpoint Presentations from Bangkok, Thailand
PHP Help - Consecutive Numbering
« on: October 16, 2012, 09:16:05 am »
I'm trying to hide some specific <tr> rows on the registration form that are not needed, but there is no way to 'target' them as it uses the same piece of coding to create all the rows.

What we have at the moment is:

      echo '   <table  class="adminForm user-details">' . "\n";
      $_table = true;
       }
       echo '      <tr>' . "\n";
       echo '         <td class="key" title="'.$_field['description'].'" >' . "\n";
       echo '            <label class="' . $_field['name'] . '" for="' . $_field['name'] . '_field">' . "\n";
       echo '               ' . $_field['title'] . ($_field['required'] ? ' *' : '') . "\n";

Where the td class is simply called "key" and all td are then called the same. We are trying to add in some consecutive lettering functionality so that each row then gets labelled with a consecutive number.

We've tried adding this into the top of the page:

<?php
// array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i');
foreach (range('a', 'z') as $letter)
?>
 Which does generate consecutive letters, and then this change to the code:

       echo '         <td class="key td-id-'.$letter.'" title="'.$_field['description'].'" >' . "\n";

Any thoughts on how to get this to work?

Thanks in advance!

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27595
  • Always on vacation
    • Jenkin Hill Internet
Re: PHP Help - Consecutive Numbering
« Reply #1 on: October 16, 2012, 13:18:44 pm »
You can use the code snippet here to hide unrequired fields based on fieldname - http://forum.virtuemart.net/index.php?topic=107226.msg358403#msg358403
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.6.10.10211 on Joomla 3.9.13 PHP 7.0.33

CMYKreative

  • Jr. Member
  • **
  • Posts: 71
    • CMYKreative - Bangkok-based Advertising, Marketing, Graphic Design, Website Design & Development, Brand Identity, Logo Design, Search Engine Optimization (SEO), Hosting, Programming, Photography and Powerpoint Presentations from Bangkok, Thailand
Re: PHP Help - Consecutive Numbering
« Reply #2 on: October 17, 2012, 03:21:12 am »
Thanks jenkinhill, but I can't do that as the only thing that defines them is the 'key' class . . . much easier to simply add an additional ID to the rows and hide as needed I would have thought.