There is a function in the class. When the page is updated, the elements change. I can not understand what exactly is being updated: a table, an array or a cycle, in order to implement the update of elements without rebooting. And how can this be done. Thank you.
Function and Block
protected function getRandomuser() { $randomuser = $this->user->getRandomElement(3); for ($i = 0; $i < count($randomuser); $i++) { $sr["name"] = $randomuser[$i]["login"]; $sr["link"] = $this->config->address."?view=userdata&login=".$sr["name"]; $sr["avatar"] = $this->getAvatar($sr["name"]); $text .= $this->getReplaceTemplate($sr, "userread"); } return $text; } <div class="userread"> <img src="%avatar%" alt="avatar" class="featured" /> <a class="name" href="%link%">%name%</a> </div> <?php $myObj = new Modules(); return $myObj->getRandomuser(); ?> Но вместо элементов выходят ошибка Fatal error: “Modules” not found in /home/shamil/domains/mrcloyd.ru/public_html/lib/get_random_user.php in line 3 Fatal error: Class 'Modules' not found in /home/shamil/domains/mrcloyd.ru /public_html/lib/get_random_user.php on line 3
Something not
<?php $myObj = new Modules(); return $myObj->getRandomuser(); ?> Class where function is located. Help to make code.
<?php abstract class Modules { protected $config; protected $user; protected $message; protected $banner; protected $data; protected $user_info; protected $friend; protected $twitt; public function __construct($db) { session_start(); $this->config = new Config(); $this->user = new User($db); $this->message = new Message(); $this->banner = new Banner($db); $this->friend = new Friend($db); $this->twitt = new Twitt($db); $this->data = $this->secureData($_GET); $this->user_info = $this->getUser(); } public function getRandomuser() { $randomuser = $this->user->getRandomElement(3); foreach ($randomuser as $row) { $sr["name"] = $row["login"]; $sr["link"] = $this->config->address."?view=userdata&login=".$sr["name"]; $sr["avatar"] = $this->getAvatar($sr["name"]); $text .= $this->getReplaceTemplate($sr, "userread"); } $new_sr["items"] = $text; return $this->getReplaceTemplate($new_sr, "userreads"); } } ?>
foreachwithforeach,foryou don’t need much here - DaemonHK