I Love PHPMaker

... because it gets even more powerful and flexible!!

  • About
  • Terms and Conditions
  • Membership Options
  • Sitemap
  • Downloads
    • PHPMaker Extensions Download
    • PHPMaker Projects Download
    • PHP Report Maker Extensions Download
I Love PHPMaker » Tips and Trick » How to Add Record Number Column on The List Page in Websites Created With PHPMaker 8.0.3
How to Add A Blank Page in Website That Created With PHPMaker 8.0.3
How to Use Local YUI Files in PHPMaker 8.0.3

September 18, 2011

How to Add Record Number Column on The List Page in Websites Created With PHPMaker 8.0.3

PHPMaker generates the list page of your website without adding the record number column on the table that located in the list page. Meanwhile, there are so many requests that asking about how to add this record number column in the list page. Even this feature is not too important, sometimes we need this Record Number column to provide the better information for users about which record numbers are being displayed in the list for the current active page.

Well, this following customization will fulfil that request, indeed! I have successfully added the record number column on the list page in websites that created with PHPMaker 8.0.3. I also added a constant into the configuration file (ewcfg*.php) file in order to enable or disable this column on the list page. After implementing this customization, then you will see there will be a new column that sits on the very left of your list page. Please note that this customization is related to the table level, so we will use and optimize the List Page section that located in the Server Events -> Table-Specific of your table from the PHPMaker application. In other words, we do not customize any generated script files.

Please click on the following image to watch the demo:

Displaying Record Number on List Page
Displaying Record Number on List Page

[hidepost]

  1. Open your /Scritp/ewcfg.php file, and find this code:

    // Show SQL for debug
    define("EW_DEBUG_ENABLED", <!--##=ew_Val(PROJ.GetV("Debug"))##-->, TRUE); // TRUE to debug
    if (EW_DEBUG_ENABLED)
    	error_reporting(-1); // Report all PHP errors
    

    after the last line of that code, please insert the following code:

    // Begin of modification Adding Record Number Column on List Page, added by Masino Sinaga, March 12, 2012
    define("SHOW_RECORD_NUMBER_COLUMN_ON_LIST", TRUE, TRUE);
    // End of modification Adding Record Number Column on List Page, added by Masino Sinaga, March 12, 2012
    
  2. Open your PHPMaker project file (.pmp) using your PHPMaker application.
  3. Click on one of the tables/views in your project until you see there are two new tabs appearing in the right side of PHPMaker application. They are: Fields and Server Events/Client Scripts tabs. Click on the Server Events/Client Scripts tab. Please note that in this example, assuming that we are using the cars list that you can find in the demo script of PHPMaker. So you will see in the following code below, the variable regarding the list is $cars_list. Please adjust it with yours according to your table/view you choose.
  4. Go to the Server Events -> Table-Specific -> List Page -> ListOptions_Load, and then replace all code in the ListOptions_Load function with this following code (assuming: you have not ever modified the original function, otherwise, adjust the following code to your existing code):

    // ListOptions Load event
    function ListOptions_Load() {
    	// Adding record number column, modified by Masino Sinaga, October 26, 2011
    	if (SHOW_RECORD_NUMBER_COLUMN_ON_LIST) {
            	$opt =& $this->ListOptions->Add("RecNo");  // RecNo will refer to ListOptions_Rendered
            	$opt->Header = "Record Number"; // the caption of column header
            	$opt->CssStyle = "text-align: center;"; // make the content center align
            	$opt->OnLeft = TRUE; // Link on left
            	$opt->MoveTo(0); // Move to first column
            }
    	// Adding record number column, modified by Masino Sinaga, October 26, 2011
    }
    
  5. Go to the Server Events -> Table-Specific -> List Page -> ListOptions_Rendered, and then replace all code in the ListOptions_Rendered function with this following code (assuming: you have not ever modified the original function, otherwise, adjust the following code to your existing code):

    // ListOptions Rendered event
    function ListOptions_Rendered() {                              
    	// Adding record number column, modified by Masino Sinaga, October 26, 2011
    	if (SHOW_RECORD_NUMBER_COLUMN_ON_LIST) {
            	global $cars_list; // <-- Don't forget to change this variable, adjust it with your table variable, including the others below!
            	// $this->ListOptions->Items["RecNo"]->Body = $cars_list->Pager->CurrentPage. " - ". $cars_list->DisplayRecs. " - ". $cars_list->StartRec;
            	// $no = $x + ($PageNo-1)*$PageSize;
            	if ($cars_list->Pager->CurrentPage > 1) {
            	  $no = $cars_list->RowCnt + ($cars_list->Pager->CurrentPage-1)*$cars_list->DisplayRecs; // normal list view, could be more than 1 page!
            	} else {
            	  $no = $cars_list->RowCnt;  // export to print list view, only 1 page!
            	}
            	$this->ListOptions->Items["RecNo"]->Body = $no;
            }
          	// Adding record number column, modified by Masino Sinaga, October 26, 2011
    
    }
    
  6. Re-generate your script files using PHPMaker application as usual, and enjoy the results.

[/hidepost]

Article by Masino Sinaga / Tips and Trick / list page, ListOptions_Load, ListOptions_Rendered, new column, PHPMaker 8.0.3, record number, Server Events 2 Comments

How to Add A Blank Page in Website That Created With PHPMaker 8.0.3
How to Use Local YUI Files in PHPMaker 8.0.3

Trackbacks

  1. How to Add Record Number Column on the Exported List Pages in Websites that Generated by PHPMaker 8.0.3 — I Love PHPMaker says:
    October 26, 2011 at 3:56 pm

    […] By Masino Sinaga Leave a Comment Still remember about the modification I made and wrote it in How to Add Record Number Column on The List Page in Websites Created With PHPMaker 8.0.3 article? Well, that modification only for adding the record number column on the list page, and not […]

    Log in to Reply
  2. How to Add Row/Record Number Column on the List Pages in Websites that Created with PHPMaker 9.0.2 — I Love PHPMaker says:
    June 3, 2012 at 9:54 am

    […] Did you still remember about the modification I created in my article which have the title How to Add Record Number Column on The List Page in Websites Created With PHPMaker 8.0.3? If so, you will see the difference between the modification I created in that article with the one […]

    Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • A New PHPMaker 2025 Project File Is Released
  • PHPMaker 2025 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2025 Is Released!
  • A New PHPMaker 2024 Project File Is Released
  • PHPMaker 2024 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2024 Is Released!
  • PHPMakerProjects.com, For Those Who Need PHPMaker Project Sample
  • A New PHPMaker 2023 Project File Is Released
  • PHPMaker 2023 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2023 Is Released!

Search

Recent Comments

  • Masino Sinaga on Masino Extensions for PHPMaker 2024 Is Released!
  • Masino Sinaga on A New PHPMaker 2024 Project File Is Released
  • Masino Sinaga on PHPMaker 2023 Demo Project File Is Released
  • Edward Babatunde on PHPMaker 2023 Demo Project File Is Released
  • Edward Babatunde on Masino Extensions for PHPMaker 2024 Is Released!

Demo Website

  • Demo of I Love PHPMaker 2025 (MasinoExtensions).
  • Stock Inventory Management for PHPMaker 2025.

Another Demo

The following template are not available in this site (must be purchased separately)

  • PHPMaker v2018 Horizontal Vertical Template.
  • PHPMaker v2017 Horizontal Vertical Template.

Demo Explanation

Stock Inventory Management is the good project for your reference, since it uses the real example in the real world. Many useful features you can use from this project, such as how to add the Thousand and Decimal separator character, and also how to calculate multiple row in Grid-Add when End-Users are entering data into the Grid-Add mode.

Categories

  • Customize Template (103)
  • General (4)
  • PHP Report Maker (17)
  • PHP Report Maker Extensions (2)
  • PHPMaker Extensions (84)
  • PHPMaker Projects (7)
  • Tips and Trick (72)

Articles based on version

  • PHPMaker 2025
  • PHPMaker 2024
  • PHPMaker 2023
  • PHPMaker 2022
  • PHPMaker 2021
  • PHPMaker 2020
  • PHPMaker 2019
  • PHPMaker 2018
  • PHPMaker 2017.0.7
  • PHPMaker 12.0.7
  • PHPMaker 11.0.6
  • PHPMaker 10.0.5
  • PHPMaker 9.2.0
  • PHPMaker 8.0.3
  • PHP Report Maker 12

(c) I Love PHPMaker 2010 - 2025 by Masino Sinaga | WordPress | Log in | Back to top