Jump to content

Nedyc

Member
  • Posts

    7
  • Joined

  • Last visited

Nedyc's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Your way is 1000x smarter than mine Thanks a lot!!! Andrea
  2. Well, suppose I want to display folders and files inside a specific folder called 'fileManager' With the controller I get files/folders name and save their name into an array called $this->content Into the view section I'll do <?PHP for($i=0;$i<count($this->content);$i++){ ?> <div><?=$this->content[$i]?></div> <?php } ?> Now i want to color of blue the second div, the forth, sixth...ecc... to graphically give a nice effect, so I thought to create a function like this and put it into the controller to separate code from views <?PHP function rowColor($colorClass){ if($colorClass = '') $colorClass = 'colored'; else $colorClass = ''; return $colorClass; } And then modify the first part of code: <?PHP $class = ''; for($i=0;$i<count($this->content);$i++){ ?> <div class="<?=$class?>"><?=$this->content[$i]?></div> <?php $class = rowColor($class); } ?>
  3. Well, I did follow the killerphp.com framework tutorial, so I'm working with something like codeIgniter and controllers are automatically dispatched; My problem is how to recall a function inside a controller from its view!
  4. Hi, into the index controller I've a public function like this public function filemanagerAction(){ function blabla(){ echo "LOL"; } } how can I call it from the view?
  5. Nedyc

    Framework problem

    Solved, I just wrote the path in a wrong way!
  6. Nedyc

    Framework problem

    Well, I've studied the php 6 tutorial on killerphp.com so I've an index like this <body> <?PHP include('dbconfig.php'); //AUTOCARICAMENTO CLASSI// define("APPLICATION_PATH",realpath("../")); $paths = array( APPLICATION_PATH, get_include_path() ); set_include_path(implode(PATH_SEPARATOR,$paths)); function __autoload($className){ //Se richiamo una classe e non la trovo $fileName = str_replace("\\","/",$className).'.php'; require_once $fileName; return; } //--AUTOCARICAMENTO CLASSI--// use \com\andorigo as path; $dbConn = new path\models\dbConnection($dbHost,$dbUsername,$dbPassword,$dbName); //CONTROLLERS// $uri = strtolower($_SERVER['REQUEST_URI']); //Se sono offline if(strpos($uri,"/public/")){ $uri = str_replace("/demo/ocarine/","",$uri); } // list($pfx,$controllerName,$actionName) = preg_split("/[\/\\\]/",$uri); switch($controllerName){ case "": case "index": $controllerName = "index"; $controller = new path\controllers\indexController($controllerName,$actionName); break; case "admin": $user = new path\models\user(); $controller = new path\controllers\adminController($controllerName,$actionName); break; } $controller->dispatch(); //--CONTROLLERS--// ?> </body> I also have the 'view' pages and their controllers, but when I try to do a script src or link a css stylesheet it won't work in any page...
  7. Nedyc

    Framework problem

    Hi, I followed killerphp's php 6 tutorial (how frameworks work) but I'm having troubles importing css or jquery...classic methods won't work... Andrea.
×
×
  • Create New...