Note that there are some explanatory texts on larger screens.

plurals
  1. POphp parent class edited variable
    primarykey
    data
    text
    <p>I have coding new project. I have create a new system because its so mixed. Firstly i have main class and its have 3 variables; </p> <ul> <li>database variable: its have ezSQL class and name is $db </li> <li>stored classes: i have helper classes and its stored this variable its named with $store </li> <li>stored data: i have put site options and other mysql datas its name $stored_data</li> </ul> <p>and its in code:</p> <pre><code>class main { var $db; var $store; var $stored_data; public function main(){ global $db; // ezsql class $this-&gt;db=$db; } public function get_helper_class($classname){ if(isset($this-&gt;store[$classname])) return $this-&gt;store[$classname]; include_once "helperclass/".$classname.".php"; $this-&gt;store[$classname]=new $classname; return $this-&gt;store[$classname]; } } </code></pre> <p>and example helper class its name option</p> <pre><code>class option extends main { public function get_option($optname){ if($this-&gt;stored_data['option'][$optname]) return $this-&gt;stored_data['option'][$optname]; // else get result and put stored_data } } </code></pre> <p>and if i use second helper</p> <pre><code>class example extends main{ public function get_data($dataname){ return $this-&gt;get_helper_class('option')-&gt;get_option('optionname'); } } </code></pre> <p>but when i call helper class my helper cant see $store['option'] data its create new option class. problem: </p> <blockquote> <p>the helper class cant get $store, $db, $stored_data variables from main class.</p> </blockquote> <p>I want get edited data and variables but its allways create new datas. what can i do?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload