Usage

alert()

Send JavaScript Alerts with PHP, in background, it prints JS alert() function, which allows developers to easily send alerts when needed from PHP, prevents code from being messed.

It accepts only one parameter, which is the alert message.

For eg: alert('Hello World')

upload()

As name defines, it uploads file on the server in one go.

Accepts 2 parameters, parameter 1, file array and parameter 2, upload Directory.

upload($filearray, $upload_directory);

There is no file size limit in this function.

Also it returns uploaded file path, so that you can save it in your Database and all.

Eg:

  $file_path = upload($_FILES['image'], 'public_images');
  • Saves data in browser's cookie

  • Age of cookies saved with this function is 30 Days

  • Accepts 2 parameters

  • Parameter 1: cookie keyname

  • Parameter 2: cookie value

  • Eg:

    save_cookie('SOM_KEY', 'SOME_VALUE')
  • Simply return cookie from the browser storage.

  • Accepts 1 parameter.

  • Parameter 1: cookie keyname

style()

  • Allow users to write styles directly from PHP.

  • Suitable for small on-page styles.

  • Accepts one parameter

  • Parameter 1: style_code

  • Eg:

  • Deletes cookie with key name.

  • Accepts one parameter which keynameof the cookie which is to be deleted.

  • Eg:

meta()

  • This function defines <head> and opens <body> in YUGAL.

  • You can define some parameter like title, keywords etc in this function.

  • It accepts an Array in it.

  • Data key is defined in array key and value in respective value.

  • For Eg:

  • Eg:

Parameters in meta()

These parameters are exactly same in spa(), add_spa() you wil learn below.

  • title as String

  • css as array accepts external CSS file path.

  • design as array accepts externa CSS in .php file

  • description as string

  • keyword as string

  • robots as boolean, it ddescirbe that should Yugal allow crawlers to crawl the page.

  • js as array, accepts external JS file path.

  • custom as string, adds custom code in <head> so that external ANALYTIC, ADS code be implied.

  • import as string, it imports component page from another page in comp, no .php is required in it. Separate multiple pages with a comma and a space ```

  • library as array, import library from lib folder, enter library folder name in lib Directory.

Some Univarsal Perameters can be defined in STRING.PHP

  • $theme_color as string defines theme colour of the app or website, it will change browser'scolour accordingly.

  • $favicon as array accepts universal Favicon to add on website, in array only two indexes are required, in 0th index enter favicon path, and 1st index enter file type. If you don't want to set Favicon, make both indexes false and upload a file with favicon.ico as file name in root Directory.

  • $common_head_tag as strng, defines common <head> tag for each page.

  • $universal_library as array, will define universal library for each page.

    open()

  • Redirects to another page.

  • PHP alternative is setting header() and then exit() that too had some issues.

  • Accepts one parameter, which is destination URL.

  • Eg:

  • Some Other example.

error()

  • Send error in Console as in JS console.error().

  • Accepts one parameter, which is error message.

  • console($errmessage)

  • Eg:

console()

  • Logs info in console.

  • Accepts one parameter, which is log message.

  • log($logmessage)

  • Eg:

warn()

  • Send warning logs info in console.

  • Accepts one parameter, which is warning message.

  • console($warnmessage)

  • Eg:

encrypt()

  • Encrypts key and Value, and saves it in the cookie.

  • Accepts 2 parameter.

  • Parameter 1: tag name

  • Parameter 2: value

  • encrypt('tagname', 'value');

  • Eg:

  • In this cookie key can not be decrypted but the value can be.

md5cook()

  • Encrypts key and Value, and saves it in the cookie.

  • Accepts 2 parameter.

  • Parameter 1: tag name

  • Parameter 2: value

  • encrypt('tagname', 'value');

  • Eg:

  • In this cookie key and value both can't be decrypted.

dccook()

  • Returns cookie value after decrypting it which was save with encrypt().

  • Accepts only on parameter, cookie key name which was given in encrypt().

  • dccook("COOKIE-KEY-NAME")

  • Eg:

  • Extra example

save_local()

  • Save data in localstorage of the browser with JS.

  • Accepts two parameters.

  • Parameter 1: keyname

  • Parameter 2: value to store

  • save_local($keyname, $value_to_store)

  • Eg:

del_local()

  • Deletes data in localstorage of the browser with JS.

  • Accepts one parameters.

  • Parameter 1: keyname

  • save_local($keyname)

  • Eg:

loadevent()

  • Hits JavaScript event, when the page is loaded.

  • Accepts one parameter, JavaScript Functions.

  • Accepts functions as string.

  • Eg:

import()

  • Import components from comp folder.

  • Only filename is required, not even .php

  • Only .php files can be imported.

  • Accepts and array()

  • Accepts only one parameter, which is too an array, which allows you to import multiple components from comp Directory.

  • import(array());

  • Eg:

clicked()

  • Hits a JavaScript event when an element is clicked.

  • Accepts 2 parameters, both as strings.

  • Parameter 1: Id of element which is clicked.

  • Parameter 2: JavaScript Function to be hitted on element click.

  • clicked($id, $function);

  • Eg:

mouseover()

  • Hits a JavaScript event when cursor comes over the respective element.

  • Accepts 2 parameters, both as strings.

  • Parameter 1: Id of element which is clicked.

  • Parameter 2: JavaScript Function to be hitted on element mouse over.

  • mouseover($id, $function);

  • Eg:

Last updated