-
-
Notifications
You must be signed in to change notification settings - Fork 166
Get data from database
Getting page data using the wCMS get function wCMS::get('pages', 'PAGENAME')->PARAM;
- PAGENAME - actual page name of the page you want to get data from
-
PARAM - page parameter. Available PARAMs for pages:
- content
- title
- description
- keywords
- other PARAMs available with plugins such as additional contents
Example A1: Get the content for page about from database.js
<?php echo wCMS::get('pages', 'about')->content; ?>
Example A2: Get title for page about
<?php echo wCMS::get('pages', 'about')->title; ?>
Example A3: Get keywords for page about
<?php echo wCMS::get('pages', 'about')->keywords; ?>
Example A4: Get description for page about
<?php echo wCMS::get('pages', 'about')->description; ?>
Example B1: Get content for current page from database.js
<?php echo wCMS::page('content'); ?>
Example B2: Get current page title
<?php echo wCMS::page('title'); ?>
Example B3: Get current page keywords
<?php echo wCMS::page('keywords'); ?>
Example B4: Get current page description
<?php echo wCMS::page('description'); ?>
Getting other data using the wCMS get function wCMS::get('config', 'PARAM'); (notice how the syntax is even easier here than fetching page data shown above).
- Available PARAMs for config
- dbVersion (returns database version)
- siteTitle (returns main website title)
- theme (returns current chosen theme)
- defaultPage (returns the default home page)
- login (returns the default login URL)
- password (returns a hashed password)
- menuItems (returns menu items)
Example C1: Get database version from database.js
<?php echo wCMS::get('config', 'dbVersion'); ?>
Example C2: Get main website title
<?php echo wCMS::get('config', 'siteTitle'); ?>
Example C3: Get theme name
<?php echo wCMS::get('config', 'theme'); ?>
Example C4: Get default page name
<?php echo wCMS::get('config', 'defaultPage'); ?>
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