Zontroy Code Generator
  • 🖌️Getting started with Zontroy
  • INTRODUCTION
    • Zontroy Code Generator
    • Advantages of Zontroy Code Generator
    • Installation
    • Zontroy Programming Language
    • Zontroy Environment
    • Zontroy Commands
  • Zontroy Project Types
    • Zontroy Project
      • Oprazi .zproject file for MSSQL
      • CrudwithGo .zproject file for MySQL
      • Course-management .zproject file for Entity
      • JavaCodeGenerator .zproject file for PostgreSQL
  • Zontroy File Types
    • Zontroy Single File
    • Zontroy Repeating File
    • Zontroy Inner Repeating File
  • Zontroy Tutorial
    • Zontroy Syntax
    • zg-entity
    • zg-entities
    • zg-if
    • zg-for
    • Data Type Conversion
    • Built-in Functions
  • Use Together
    • Github Copilot
    • ChatGPT
  • Zontroy How To
    • Javascript
    • Typescript
    • Java
    • Python
    • CSharp
    • PHP
Powered by GitBook
On this page
  • zsif
  • File Naming Format
  • File Naming Example
  • Code Example
  • Output Example
  • Generate in Zontroy IDE
  1. Zontroy File Types

Zontroy Single File

PreviousJavaCodeGenerator .zproject file for PostgreSQLNextZontroy Repeating File

Last updated 7 months ago

Zontroy has 3 file types to generate code.

zsif

Zontroy Single File is used to generate lines of code inside a single file. It uses .zsif extension.

File Naming Format

[file_name].[file_extension].zsif

File Naming Example

MyCodeFile.java.zsif

Code Example

A simple usage example of zsif file in React.js.

// PrivateRoutes.tsx.zsif
import {Suspense} from 'react'
import {Route} from 'react-router-dom'

zg-for(((zg-item:::[[[zg-entities]]]))){{{
const [[[zg-item...zg-name]]]Page = lazy(() => import('../modules/zg-lower(((zg-item...zg-name)))/zg-singularize(((zg-item...zg-name)))Page'))   
}}}

zg-for(((zg-item:::[[[zg-entities]]]))){{{
  <Route
    path='crafted/zg-pluralize(((zg-lower(((zg-item...zg-name))))))/zg-lower(((zg-item...zg-name)))/*'
    element={
      <SuspensedView>
        <[[[zg-item...zg-name]]]Page />
      </SuspensedView>
    }
  />
}}}

Output Example

// PrivateRoutes.tsx.zsif
import {Suspense} from 'react'
import {Route} from 'react-router-dom'
    

const cityPage = lazy(() => import('../modules/city/cityPage'))   

const countryPage = lazy(() => import('../modules/country/countryPage'))   

const customerPage = lazy(() => import('../modules/customer/customerPage'))   



  <Route
    path='crafted/cities/city/*'
    element={
      <SuspensedView>
        <cityPage />
      </SuspensedView>
    }
  />

  <Route
    path='crafted/countries/country/*'
    element={
      <SuspensedView>
        <countryPage />
      </SuspensedView>
    }
  />

  <Route
    path='crafted/customers/customer/*'
    element={
      <SuspensedView>
        <customerPage />
      </SuspensedView>
    }
  />

Generate in Zontroy IDE

Create an Empty Zontroy Project using menu File -> New Project -> Create (Empty Zontroy Project).

Add a zsif file into the project

Name the file as PrivateRoutes.tsx.zsif or anything you want and click Add File

Open newly created zsif file, write the code provided above as an example and save it.

Click blue generate button and see the output

Good to know: In daily programming, routing, object mapping, dependency injection and context management are sample concepts which for using a single code file.

Multiple entities to one code file