YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\EMBED_PAGE\PAGE\embedPage Class Reference

Embed any static page in any widget position. More...

Public Member Functions

 __construct ($db)
 Load all widget settings from database and fill object. More...
 
 init ()
 Init and embed static page. More...
 

Public Attributes

 $embedPageName = ''
 
 $file = ''
 
 $widget = ''
 

Detailed Description

Embed any static page in any widget position.

Embed any static page in any widget position.

Simply set the page you want to embed.

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 14 of file embedPage.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\EMBED_PAGE\PAGE\embedPage::__construct (   $db)

Load all widget settings from database and fill object.

Parameters
object$dbDatabase Object

Load all widget settings on object init.

Definition at line 28 of file embedPage.php.

29  {
30  // load this widget settings from db
31  $this->widget = new \YAWK\widget();
32  $settings = $this->widget->getWidgetSettingsArray($db);
33  foreach ($settings as $property => $value) {
34  $this->$property = $value;
35  }
36  }
if(isset($_POST['save'])) $settings
$value

References $db, $settings, $value, and YAWK\widget\getWidgetSettingsArray().

Member Function Documentation

◆ init()

YAWK\WIDGETS\EMBED_PAGE\PAGE\embedPage::init ( )

Init and embed static page.

Parameters
object$dbDatabase Object

Init and include static page.

Definition at line 43 of file embedPage.php.

44  { // check if embed page name is set
45  if (isset($this->embedPageName) && (!empty($this->embedPageName)))
46  {
47  // generate file name including path
48  $this->file = "content/pages/$this->embedPageName";
49  // check file extension
50  if (substr($this->file, -5) == ".html")
51  { // remove last 5 chars and add .php to include correct file
52  $this->file = substr($this->file, 0, -5);
53  $this->file = $this->file.".php";
54  }
55  // check if file can be loaded
56  if (is_file($this->file))
57  { // ok, include it
58  include ($this->file);
59  }
60  // if not, check if embedPageName can be loaded
61  else if (is_file($this->embedPageName))
62  { // ok, include it
63  include ($this->embedPageName);
64  }
65  else
66  { // file not found
67  echo "Embed: $this->file not found!";
68  }
69  }
70  else
71  { // no file was set...
72  echo "Embed page name $this->embedPageName not set";
73  }
74  }

Member Data Documentation

◆ $embedPageName

YAWK\WIDGETS\EMBED_PAGE\PAGE\embedPage::$embedPageName = ''
Parameters
stringThe name of the page to embed

Definition at line 19 of file embedPage.php.

◆ $file

YAWK\WIDGETS\EMBED_PAGE\PAGE\embedPage::$file = ''
Parameters
stringFile url, including path

Definition at line 21 of file embedPage.php.

◆ $widget

YAWK\WIDGETS\EMBED_PAGE\PAGE\embedPage::$widget = ''
Parameters
objectglobal widget object data

Definition at line 17 of file embedPage.php.


The documentation for this class was generated from the following file: