Results 1 to 4 of 4
  1. #1
    Newbie
    Join Date
    July 10th, 2005
    Posts
    2
    Question about the "mod" operator
    Is it possible to use the "mod" operator to create alternate table row styles AND limit the number of records being displayed when creating an index page? I have tried to use the CurrentRecordNumber and IndexRecordNumber values but neither seems to work. Basically, I want to display a limited number of records on my homepage for a specific range or type of data. However, I also want to alternate the background color of each record to help separate the visibility each record.

    I have tried doing the following:

    [WM-RECORD][WM-IF (CurrentRecordNumber < 6) and (CurrentRecordNumber mod 2)]
    HTML odd
    [WM-Else]
    HTML even
    [/WM-IF][/WM-RECORD]

    I have also tried this:

    [WM-IF CurrentRecordNumber < 6][WM-RECORD][WM-IF CurrentRecordNumber mod 2]
    HTML odd
    [WM-Else]
    HTML even
    [/WM-IF][/WM-RECORD][/WM-IF]

    In the first example, the table rows will alternate background colors for the first 5 records but this also displays all records in the database after #5 with the "HTML even" formatting. The second example inserts the [/WM-IF] statement at the top of the results. If I take that statement out, there is an error. I have also tried usin the IndexRecordNumber value instead fo the CurrentRecordNumber value to no avail.

    I am sure there is a simple solution to this or it is something that I have overlooked. Is there someone that can help me?

  2. #2
    Affiliate Manager
    Join Date
    January 18th, 2005
    Location
    Los Angeles, California
    Posts
    1,913
    Nested IFs aren't currently supported, but offhand the first example looks like it should work.

    If not, does it honor at least the mod expression if you remove the first one?
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  3. #3
    Newbie
    Join Date
    July 10th, 2005
    Posts
    2
    The first example will work fine for the first 5 records but the problem is that it also displays all records in the database instead of limiting the number to 5. Each record after #5 is displayed with the "even" formatting.

    Quote Originally Posted by FourthWorld
    If not, does it honor at least the mod expression if you remove the first one?
    The mod expression works fine on its own.

  4. #4
    Affiliate Manager
    Join Date
    January 18th, 2005
    Location
    Los Angeles, California
    Posts
    1,913
    Ah, I see. The behavior you describe is logical: The expression as a whole returns either true or false, and if true it uses the first portion of the IF block, and if not it uses the latter.

    It would be ideal for me to add a way to specify limited ranges of records, and I'll see what I can do for that. But in the meantime since you're only working on a small number of records you could copy those to a separate source file to make that page.
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Bad bod mod for .htaccess? "user-agent string: Java/1.4.1_04"
    By lostdeviant in forum Midnight Cafe'
    Replies: 5
    Last Post: January 16th, 2009, 10:18 AM
  2. Replies: 2
    Last Post: July 29th, 2005, 01:51 PM
  3. Datafeeds & Google: bad "news" - Are you a "thin affiliate" ?
    By heisje in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: June 29th, 2005, 08:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •