Skip to content

Set data to database

Robert Isoski edited this page Dec 7, 2019 · 3 revisions

wCMS::set()

  • can be used to save data to database.js

Examples for WonderCMS 3.0.0+

// Set new website title 
$Wcms->set('config', 'siteTitle', 'My website title');
// Set current theme to "default"
$Wcms->set('config', 'theme', 'default');

Additional examples

// Set title for "Page-name"
$Wcms->set('pages', 'Page-name', 'title', 'Your title here');
// Set content for "Page-name"
$Wcms->set('pages', 'Page-name', 'content', 'Page content here');
// Set SEO keywords for "Page-name"
$Wcms->set('pages', 'Page-name', 'keywords', 'Page, keywords, here');
// Set SEO description for "Page-name"
$Wcms->set('pages', 'Page-name', 'description', 'Page description for search engines.');

Examples for WonderCMS 2.7.0 and lower versions

// Set new website title 
wCMS::set('config', 'siteTitle', 'My website title');
// Set current theme to "default"
wCMS::set('config', 'theme', 'default');

Additional examples

// Set title for "Page-name"
wCMS::set('pages', 'Page-name', 'title', 'Your title here');
// Set content for "Page-name"
wCMS::set('pages', 'Page-name', 'content', 'Page content here');
// Set SEO keywords for "Page-name"
wCMS::set('pages', 'Page-name', 'keywords', 'Page, keywords, here');
// Set SEO description for "Page-name"
wCMS::set('pages', 'Page-name', 'description', 'Page description for search engines.');

Helpful links

Clone this wiki locally