Usage
alert()
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()
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');save_cookie()
save_cookie()Saves data in browser's cookie
Age of
cookiessaved with this function is30 DaysAccepts 2 parameters
Parameter 1:
cookie keynameParameter 2:
cookie valueEg:
save_cookie('SOM_KEY', 'SOME_VALUE')
cookie()
cookie()Simply return
cookiefrom the browser storage.Accepts 1 parameter.
Parameter 1:
cookie keyname
style()
style()Allow users to write styles directly from
PHP.Suitable for small on-page styles.
Accepts one parameter
Parameter 1:
style_codeEg:
delete_cookie()
delete_cookie()Deletes cookie with key name.
Accepts one parameter which keynameof the cookie which is to be deleted.
Eg:
meta()
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
Arrayin it.Data key is defined in array key and value in respective value.
For Eg:
Eg:
Parameters in meta()
meta()These parameters are exactly same in spa(), add_spa() you wil learn below.
titleas Stringcssas array accepts externalCSSfile path.designas array accepts externa CSS in.phpfiledescriptionas stringkeywordas stringrobotsas boolean, it ddescirbe that should Yugal allow crawlers to crawl the page.jsas array, accepts external JS file path.customas string, adds custom code in<head>so that external ANALYTIC, ADS code be implied.importas string, it imports component page from another page incomp, no.phpis required in it. Separate multiple pages with a comma and a space ```libraryas array, import library fromlibfolder, enterlibraryfolder name inlibDirectory.
Some Univarsal Perameters can be defined in STRING.PHP
STRING.PHP$theme_colorasstringdefines theme colour of the app or website, it will change browser'scolour accordingly.$faviconasarrayaccepts 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 indexesfalseand upload a file withfavicon.icoas file name in root Directory.$common_head_tagas strng, defines common<head>tag for eachpage.$universal_libraryasarray, will define universal library for each page.open()Redirects to another page.
PHPalternative is settingheader()and thenexit()that too had some issues.Accepts one parameter, which is destination URL.
Eg:
Some Other example.
error()
error()Send error in Console as in JS
console.error().Accepts one parameter, which is error message.
console($errmessage)Eg:
console()
console()Logs info in console.
Accepts one parameter, which is log message.
log($logmessage)Eg:
warn()
warn()Send warning logs info in console.
Accepts one parameter, which is warning message.
console($warnmessage)Eg:
encrypt()
encrypt()Encrypts key and Value, and saves it in the cookie.
Accepts 2 parameter.
Parameter 1:
tag nameParameter 2:
valueencrypt('tagname', 'value');Eg:
In this cookie key can not be decrypted but the value can be.
md5cook()
md5cook()Encrypts key and Value, and saves it in the cookie.
Accepts 2 parameter.
Parameter 1:
tag nameParameter 2:
valueencrypt('tagname', 'value');Eg:
In this cookie key and value both can't be decrypted.
dccook()
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_local()Save data in
localstorageof the browser with JS.Accepts two parameters.
Parameter 1:
keynameParameter 2:
value to storesave_local($keyname, $value_to_store)Eg:
del_local()
del_local()Deletes data in
localstorageof the browser with JS.Accepts one parameters.
Parameter 1:
keynamesave_local($keyname)Eg:
loadevent()
loadevent()Hits
JavaScriptevent, when the page is loaded.Accepts one parameter,
JavaScript Functions.Accepts functions as string.
Eg:
import()
import()Import components from
compfolder.Only filename is required, not even
.phpOnly
.phpfiles can be imported.Accepts and
array()Accepts only one parameter, which is too an
array, which allows you to import multiple components fromcompDirectory.import(array());Eg:
clicked()
clicked()Hits a
JavaScriptevent when an element is clicked.Accepts 2 parameters, both as
strings.Parameter 1: Id of element which is clicked.
Parameter 2:
JavaScript Functionto be hitted on element click.clicked($id, $function);Eg:
mouseover()
mouseover()Hits a
JavaScriptevent when cursor comes over the respective element.Accepts 2 parameters, both as
strings.Parameter 1: Id of element which is clicked.
Parameter 2:
JavaScript Functionto be hitted on element mouse over.mouseover($id, $function);Eg:
Last updated