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 » Customize Template » How to Change the Separator Character for Export to CSV in Websites that Generated by PHPMaker 9.2.0
Incorporating Alertify Code into Javascript Template Files of PHPMaker 10.0.1
How to Make Right-Align Columns for Aggregate Functions in Websites that Generated by PHPMaker 9.2.0

April 19, 2013

How to Change the Separator Character for Export to CSV in Websites that Generated by PHPMaker 9.2.0

This following customization will show you how you can change the separator character for Export to CSV file in web applications that generated by PHPMaker. As we have already known, the default separator character that used by PHPMaker is a comma (,) character. In this following example, let's say we will change it become the semicolon character.

We will customize the PHPMaker template to achieve this, so that you can use the template for your future project. By following this customization, then you will see how PHPMaker has provided us the great Class for Export to ... feature. You will also learn how you can extend the base class which is being used for Export feature according to your needs. This is one of the features provided by PHPMaker that I love it so much.

[hidepost]

  1. Open your \Script\phpfn.php file, and find this code:

    class cExportCsv extends cExportBase {
    
    	var $QuoteChar = "\"";
    	
    	// Style
    	function ChangeStyle($style) {
    		$this->Horizontal = TRUE;
    	}
    
    	// Table header
    	function ExportTableHeader() {
    		// Skip
    	}
    
    	// Export a value (caption, field value, or aggregate)
    	function ExportValueEx(&$fld, $val, $usestyle = TRUE) {
    		if ($this->Line <> "")
    			$this->Line .= ",";
    		$this->Line .= $this->QuoteChar . str_replace($this->QuoteChar, $this->QuoteChar . $this->QuoteChar, strval($val)) . $this->QuoteChar;
    	}
    

    then replace it with the following code:

    class cExportCsv extends cExportBase {
    
    	var $QuoteChar = "\"";
    	
    	// Style
    	function ChangeStyle($style) {
    		$this->Horizontal = TRUE;
    	}
    
    	// Table header
    	function ExportTableHeader() {
    		// Skip
    	}
    
    	// Export a value (caption, field value, or aggregate)
    	function ExportValueEx(&$fld, $val, $usestyle = TRUE) {
    		if ($this->Line <> "")
    			$this->Line .= ";"; // replacing "comma" with "semicolon" character.
    		$this->Line .= $this->QuoteChar . str_replace($this->QuoteChar, $this->QuoteChar . $this->QuoteChar, strval($val)) . $this->QuoteChar;
    	}
    
  2. Finally, re-generate your script files using PHPMaker as always.

[/hidepost]

Article by Masino Sinaga / Customize Template / comma separator, Export to CSV, PHPMaker 9.2.0 Leave a Comment

Incorporating Alertify Code into Javascript Template Files of PHPMaker 10.0.1
How to Make Right-Align Columns for Aggregate Functions in Websites that Generated by PHPMaker 9.2.0

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 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!
  • A New PHPMaker 2022 Project File Is Released
  • PHPMaker 2022 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2022 Is Released!

Search

Recent Comments

  • Masino Extensions untuk PHPMaker 2024 Sudah Dirilis, Silahkan Download! – Masino Sinaga on Membership Options
  • Masino Sinaga on Masino Extensions for PHPMaker 2022 (All-In-One)
  • Filipe Vercesi on Masino Extensions for PHPMaker 2022 (All-In-One)
  • Mandwa on Masino Extensions for PHPMaker 2023 Is Released!
  • Masino Sinaga on Masino Extensions for PHPMaker 2023 Is Released!

Demo Website

  • Demo of I Love PHPMaker 2024 (MasinoExtensions).
  • Stock Inventory Management for PHPMaker 2024.
  • Stock Inventory Management for PHPMaker 2023.
  • Stock Inventory Management for PHPMaker 2022.
  • Stock Inventory Management for PHPMaker 2021.

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 (83)
  • PHPMaker Projects (5)
  • Tips and Trick (72)

Articles based on version

  • 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 - 2023 by Masino Sinaga | WordPress | Log in | Back to top