-
-
Notifications
You must be signed in to change notification settings - Fork 166
Get data from database
Robert Isoski edited this page Dec 7, 2019
·
12 revisions
- can be used to get data from database.js
-
$Wcms->get('pages', 'PAGENAME')->PARAM;
- Param examples: title, content, keywords, description
Explanation of PAGENAME and PARAM and how they can be used:
- PAGENAME - name of the page you want to get data from. For this example, we will use the page about.
-
PARAM - page parameter. Available page parameters (for pages) are:
- content
- example:
<?php echo $Wcms->get('pages', 'about')->content; ?>
returns content for page about
- example:
- title
- example:
<?php echo $Wcms->get('pages', 'about')->title; ?>
returns title for page about
- example:
- description
- example:
<?php echo $Wcms->get('pages', 'about')->description; ?>
returns description for page about
- example:
- keywords
- example:
<?php echo $Wcms->get('pages', 'about')->keywords; ?>
returns keywords for page about
- example:
- other PARAMs are available with plugins (such as additional contents)
- content
-
<?php echo $Wcms->page('content'); ?>
returns content for current page -
<?php echo $Wcms->page('title'); ?>
returns title for current page -
<?php echo $Wcms->page('keywords'); ?>
returns keywords for current page -
<?php echo $Wcms->page('description'); ?>
returns description for current page
Getting other data using the Wcms get function $Wcms->get('config', 'PARAM'); (notice how the syntax is shorter than fetching page data shown above).
- Available PARAMs for config
- dbVersion
- example:
<?php echo $Wcms->('config', 'dbVersion'); ?>
returns database version
- example:
- siteTitle
- example:
<?php echo $Wcms->('config', 'siteTitle'); ?>
returns main website title
- example:
- theme
- example:
<?php echo $Wcms->('config', 'theme'); ?>
returns current chosen theme
- example:
- defaultPage
- example:
<?php echo $Wcms->('config', 'defaultPage'); ?>
returns the default home page
- example:
- login
- example:
<?php echo $Wcms->('config', 'login'); ?>
returns the default login URL
- example:
- password
- example:
<?php echo $Wcms->('config', 'password'); ?>
returns hashed password
- example:
- menuItems
- example:
<?php echo $Wcms->('config', 'menuItems'); ?>
returns each menu item as list item<li><a href="//example.com/home">home</a></li>
- example:
- dbVersion
Explanation of PAGENAME and PARAM and how they can be used:
- PAGENAME - name of the page you want to get data from. For this example, we will use the page about.
-
PARAM - page parameter. Available page parameters (for pages) are:
- content
- example:
<?php echo wCMS::get('pages', 'about')->content; ?>
returns content for page about
- example:
- title
- example:
<?php echo wCMS::get('pages', 'about')->title; ?>
returns title for page about
- example:
- description
- example:
<?php echo wCMS::get('pages', 'about')->description; ?>
returns description for page about
- example:
- keywords
- example:
<?php echo wCMS::get('pages', 'about')->keywords; ?>
returns keywords for page about
- example:
- other PARAMs are available with plugins (such as additional contents)
- content
-
<?php echo wCMS::page('content'); ?>
returns content for current page -
<?php echo wCMS::page('title'); ?>
returns title for current page -
<?php echo wCMS::page('keywords'); ?>
returns keywords for current page -
<?php echo wCMS::page('description'); ?>
returns description for current page
Getting other data using the wCMS get function wCMS::get('config', 'PARAM'); (notice how the syntax is shorter than fetching page data shown above).
- Available PARAMs for config
- dbVersion
- example:
<?php echo wCMS::get('config', 'dbVersion'); ?>
returns database version
- example:
- siteTitle
- example:
<?php echo wCMS::get('config', 'siteTitle'); ?>
returns main website title
- example:
- theme
- example:
<?php echo wCMS::get('config', 'theme'); ?>
returns current chosen theme
- example:
- defaultPage
- example:
<?php echo wCMS::get('config', 'defaultPage'); ?>
returns the default home page
- example:
- login
- example:
<?php echo wCMS::get('config', 'login'); ?>
returns the default login URL
- example:
- password
- example:
<?php echo wCMS::get('config', 'password'); ?>
returns a hashed password
- example:
- menuItems
- example:
<?php echo wCMS::get('config', 'menuItems'); ?>
returns each menu item as list item<li><a href="//example.com/home">home</a></li>
- example:
- dbVersion
Still need help?
- Ask a question or make a request in the community.
- Official website
Intro
- Home
- Demo
- Download
- One step install
- Requirements
- 5 file structure
- List of hooks
- Included libraries
- Create theme in 8 easy steps
- Create a plugin
- Custom modules
- Translations
- All security features described
Basic how to's
- Backup all files
- Change default login URL
- Change default password
- Create custom page template
- Create new editable areas or editable blocks
- Edit 404 page
- Get data from database
- Set data to database
- Hide page from menu
- Caddy web server config
- IIS server config
- NGINX server config
- Login
- Recover login URL
- Reset password
- Restore backup
- Update
- PHP built in server
Themes
- Create theme in 8 easy steps
- Add favicon
- Theme tags
- Update theme to work with WonderCMS 2.0.0
- Update theme to work with WonderCMS 3.0.0
- Share your themes with Custom modules
Plugins
- Quick intro on creating plugins and List of hooks
- Share your plugin with simply with Custom modules
Security
- All security features described
- Add SRI tags to your theme libraries
- Always redirect to https and www
- Additional security configuration(s)
- Add SRI tags to your theme libraries
- Better security mode (HTTPS and other features)
Features description
- One click update
- Optional: functions.php file
- Default database.js
- Allowed extensions file types for uploads
- Login URL doesn't work - 404
- 500 internal server error
- Persistent "New WonderCMS update available" message
- URLs mailformed on Windows IIS
- Other errors