Page
An object for adding, viewing, editing and deleting a specific web page.
Page PHP Methods
add(array $fieldValues) v5
Adds a new record.
PARAMETERS:
$fieldValues = Array of the values for each column when adding the record (Associative array with key = field name & value = field value).
RETURN VALUE:
int = id of the new record.
0 = if fails checkLoaded() v5
Checks if record is loaded. throwing an error if the record failed to load successfully.
PARAMETERS:
NONE
RETURN VALUE:
VOID clonePage(\WMT\Container $container, int $memberID, int $page, bool $isBackup = false, bool $isDuplicate = false) v5
Duplicate/clone a page
PARAMETERS:
$container = object
$memberID = int, the new page (cloned page) owner
$page = int, page ID
$isBackup = bool, true if the clone is a backup, false otherwise
$isDuplicate = bool, true if the clone is duplicating the page, false otherwise
RETURN VALUE:
int = page ID convertHTML(string $htmlContent = "", string $prefix = "", bool $urlEncode = false) v5
Converts ~~ variables in the $htmlContent that is provided and returns the converted content. The title of the ~~ variables are converted by the content from the column in the database with the matching title.
PARAMETERS:
$htmlContent = String, HTML content body to convert.
$prefix= String, tilde code prefix if any.
$urlEncode = Bool, true if you want to apply URL encode to the content, false otherwise
RETURN VALUE:
String = Converted HTML delete(string $restoreQuery = "") v5
Deletes the loaded record from the database.
PARAMETERS:
$restoreQuery = FOR INTERNAL USE. FOR TYPICAL USAGE LEAVE THIS BLANK. The restore query to pass along when deleting an object with dependencies.
RETURN VALUE:
VOID duplicate(array $newValues = null) v5
Creates a duplicate record in the database of the current object
PARAMETERS:
$newValues = array, associative array with field name as key and field value as array value containing the new values if any
RETURN VALUE:
int = the id of the new record. function load(string $queryWhere) v5
Loads values for the record matching the criteria specified by $queryWhere. If the there is more than one record returned from the query then only the first record is loaded.
PARAMETERS:
$queryWhere = String, SQL where query.
RETURN VALUE:
Bool = true, if success, false otherwise getBody() v5
Gets page body content (first editable content) for the loaded page
PARAMETERS:
NONE
RETURN VALUE:
string = first editable content HTML getContent(int $cpc) v5
Gets page HTML content for the loaded page
PARAMETERS:
$cpc = int, editable content count number
RETURN VALUE:
string = editable content HTML getContentCount() v5
Gets number of editable contents in the loaded page object
PARAMETERS:
NONE
RETURN VALUE:
int = number of editable contents in the loaded page object getDatabaseName() v5
Returns object's database table name
PARAMETERS:
NONE
RETURN VALUE:
String = Database name getDefaultTRHTML() v5
Returns the default html code for a tr row with all of the fields from the database in it as ~~ vars
PARAMETERS:
NONE
RETURN VALUE:
String = the default HTML code for a tr row with all of the fields from the database in it as ~~ vars getID() v5
Sets object ID
PARAMETERS:
NONE
RETURN VALUE:
int = ID getJSON(bool $returnArr = false) v5
Get JSON array for the loaded record.
PARAMETERS:
Bool = true if want to return JSON, false otherwise
RETURN VALUE:
Object Array or JSON encoded version of the array getMemberRedirectURL(\WMT\SQL\Member\Member $member, \WMT\Settings\Core $coreSettings) v5
Gets the loaded page capture form redirect URL for a specific member
PARAMETERS:
$member = object
$coreSettings = object
RETURN VALUE:
string = redirect URL getRedirectURL() v5
Gets the loaded page capture form redirect URL
PARAMETERS:
NONE
RETURN VALUE:
string = redirect URL getStatsDayTotal() v5
Gets the loaded page object stats for today
PARAMETERS:
NONE
RETURN VALUE:
int = Number of page views today getStatsMonthTotal() v5
Gets the loaded page object stats for this month
PARAMETERS:
NONE
RETURN VALUE:
int = Number of page views this month getStatsTotal() v5
Gets the loaded page object stats all the time
PARAMETERS:
NONE
RETURN VALUE:
int = Number of page views all the time getStatsWeekTotal() v5
Gets the loaded page object stats for this week
PARAMETERS:
NONE
RETURN VALUE:
int = Number of page views this week getStatsYearTotal() v5
Gets the loaded page object stats for this year
PARAMETERS:
NONE
RETURN VALUE:
int = Number of page views this year getText(int $tID) v5
Gets page text content for the loaded page
PARAMETERS:
$tID = int, editable content count number
RETURN VALUE:
string = editable content text getURL(\WMT\SQL\Member\Member $member) v5
Get the page's full URL
PARAMETERS:
$member = object
RETURN VALUE:
string = page URL getValue(string $fieldName = "value") v5
Returns the value from a specific column for this record.
PARAMETERS:
$fieldName = String, field name.
RETURN VALUE:
Field value hasField(string $fieldName) v5
Checks if the field shown or hidden
PARAMETERS:
$fieldName= String, Field title.
RETURN VALUE:
Bool= True if the field show is true, false otherwise hideAllFields() v5
hides all fields(columns)
PARAMETERS:
NONE
RETURN VALUE:
VOID hideField($fieldTitle) v5
Hides specific field title by its column title
PARAMETERS:
$fieldTitle = String, Field title.
RETURN VALUE:
VOID isLoaded() v5
Checks if an object is loaded correctly (can be used to check if ID exists).
PARAMETERS:
NONE
RETURN VALUE:
Bool = True if the object loaded successfully, false otherwise loadFilename(string $filename, int $memberID = 1) v5
Loads page by its filename
PARAMETERS:
$filename = string, page file name
$memberID = int, member ID (referrer)
RETURN VALUE:
int = 0 if the page failed to load, 1 if loaded successfully loadFirstID() v5
Get object's first id
PARAMETERS:
NONE
RETURN VALUE:
int = First ID loadID(int $id) v5
Loads values for the record with the id specified.
PARAMETERS:
$id = int, record ID.
RETURN VALUE:
Bool = true, if success, false otherwise loadPage(int $pageID, \WMT\Settings\Core $coreSettings, int $memberID, int $parentID = 0, bool $canSharePages = false) v5
Loads a page
PARAMETERS:
$pageID = int, page ID
$coreSettings = object
$memberID = int, page owner member ID
$parentID = int, member's parent ID (if the page was shared)
$canSharePages = bool, true to allow share the page with downline, false otherwise
RETURN VALUE:
int = 0 if the page failed to load, page ID if loaded correctly makeMyRedirect(int $memberID) v5
Set the loaded page as member's default redirect URL
PARAMETERS:
$memberID = int, member ID
RETURN VALUE:
void save(array $fieldValues) v5
Saves the record with the new values specified in the $fieldValuesarray.
PARAMETERS:
$fieldValues = Array of the values for each column when adding the record (Associative array with key = field name & value = field value).
RETURN VALUE:
Bool = True on success, False otherwise. setMyMemberID(int $memberID) v5
Sets member's ID
PARAMETERS:
$memberID = int, member id
RETURN VALUE:
VOID setRestoreID(int $id) v5
Sets restor point ID
PARAMETERS:
$id = int, restore ID
RETURN VALUE:
VOID settingHTTPS(bool $useHTTPS = true) v5
Sets site to use https or http
PARAMETERS:
$useHTTPS = True if https on, false otherwise (default true).
RETURN VALUE:
VOID settingSiteURL(string $siteURL) v5
Sets Site Domain
PARAMETERS:
$siteURL = String, site URL
RETURN VALUE:
VOID showAllFields() v5
Show all fields(columns)
PARAMETERS:
NONE
RETURN VALUE:
VOID showField($fieldTitle) v5
Shows specific field title by its column title
PARAMETERS:
$fieldTitle = String, Field title.
RETURN VALUE:
VOIDPage PHP Variables
🔎︎ %l4610%
Columns in the pages Database Table:
id title description keywords filename editable member number type redirect notes dorder contactgroup membership membercanedit passprotect exitpopup allowdownlinecopy allowallcopy isbackup pagedynamic afterdelay afternotify aftercontactgroup afterimessage chat bootstrap inviteron aftergroupmatch updated afterpoints aftertitle ispublic hideredirect fbimage lightbox ismobile responsive afterpagecontent autosave
Code Example
Use the code below to
view a record in an
html page:
Use the code below to
add a record:
Use the code below to
delete a record:
Sample Usage
Below is an example of how to get page content. The example is from within / (the main/root folder):