Useful FUnctions

This page will document on all the functions available in sociaVIBE core and if you don't find what function you are 

looking for kindly check functions file at 

includes/functions.php

# path()

This function provide the base path to your crea8socialPRO installation and it can be use to generate a full path to a folder or file
as you can see in the example below

$basePath = path();//Full path to sociaVIBE base
$includesPath = path("includes/")
//and can also be use to get full path to a file
$filePath = path("includes/functions.php") //this give the full path to the functions file in the includes folder

# plugin_path()

This function provide base path to plugins, if you don't know where the plugins exist please check
the folder structure introduction to understand more about it.

 This function has two parameters, the first one is the Plugin name for example event
and the second parameter also takes string value of the relative path in the plugin folder, examples are shown below

plugin_path("pluginname", "pages/")

This function will return what you see below

//This will return something like base-to-your-installation/plugins/pluginame/pages/

# db()

This function return the mysqli connection object for making query to the database easily, as show below

$query = db()->query("select * from table_name where id='1'")

# lang()

Function to get language translation from the selected language, it has two parameters the first parameter represent the index in the language file and the second parameter is an array key and values to replace words in the translation, as show below

<?php echo lang("site-description") ?>

Or if you are calling a language file from plugiin or your plugin you do it like this

<?php echo lang("pluginname::site-description") ?>

# getFullUrl()

This function give you the current url of the request 

# isSecure()

You can check  if the current request is secure or not

#app()

This function give the current instance of the App class

# img()

With this function you can get link to your image saved in your plugin files or themes section any other, it takes two pararameter $path  and $size for example

<img src="<?php echo img('images/game.jpg')?>" alt=""/>

Or from a plugin directory

<img src="<?php echo img('pluginname::images/game.jpg')?>" alt=""/>

 

You can check the functions.php file to see more useful functions and some of them will be use in other tutorials

 

Thanks