Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - philtheweb

Pages: [1]
1
TinyMVC Framework Development / TinyMVC_PDO_Model instead ?
« on: September 11, 2008, 08:57:55 am »

Woudnt it be more appropriate to have an empty TinyMVC_Model Class and having for example TinyMVC_PDO_Model extend TinyMVC_Model ?

Code: [Select]
class TinyMVC_Model
{
 
   
  /**
* class constructor
*
* @access public
*/
  function __construct() {
   
  }
 
}


class TinyMVC_PDO_Model extends TinyMVC_Model{
   
        /**
* $db
*
* the database object instance
*
* @access public
*/
        var $db = null; 
   
        function __construct($poolname=null){
            $this->db = tmvc::instance()->load->database($poolname);
        }
       
       
    }


2
Bug Reports / Cant have 2 library extending TinyMVC_Controller ?
« on: August 18, 2008, 10:04:33 am »
Here is a simple example ,

I created 2 "plugins" called , library.testa.php and library.testb.php ,

 library.testa.php :
Code: [Select]
<?php

    
class testa extends TinyMVC_Controller{
        
        function 
index(){
            echo 
"testa";
        }
        
    }

?>


 library.testb.php :
Code: [Select]
<?php

    
class testb extends TinyMVC_Controller{
        
        function 
index(){
            echo 
"testb";
        }
        
    }

?>


Now in my default controller i load both libraries :
Code: [Select]
<?php

/**
 * default.php
 *
 * default application controller
 *
 * @package TinyMVC
 * @author Monte Ohrt
 */

class Default_Controller extends TinyMVC_Controller
{
  function 
index()
  {
    
$this->load->library('testa','testa'); 
    
$this->load->library('testb','testb');
       
    
$this->testa->index();
    
$this->testb->index();
      
  }
}

?>



And i get this  :

testa 

TinyMVC Error: Undefined property: Default_Controller::$testb
File: /var/www/tmvc/tinymvc/myapp/controllers/default.php
Line: 28
Fatal error: Call to a member function index() on a non-object in /var/www/tmvc/tinymvc/myapp/controllers/default.php on line 28

Tho if they are not extended by TinyMVC_Controller or a custom controller , there is no problem

Should i instead do this : ?

 library.testa.php && library.testb.php :
Code: [Select]
<?php

    
class testa{
        
        function 
index($controller){
            echo 
"testa";
            
$controller->view->assign(...);
        }
        
    }

?>


default.php
Code: [Select]
<?php

/**
 * default.php
 *
 * default application controller
 *
 * @package TinyMVC
 * @author Monte Ohrt
 */

class Default_Controller extends TinyMVC_Controller
{
  function 
index()
  {
    
$this->load->library('testa','testa'); 
    
$this->load->library('testb','testb');
       
    
$this->testa->index(&this);
    
$this->testb->index(&this);
      
  }
}

?>



Thanks

3
Bug Reports / $this->view->display , not showing view assigned vars
« on: August 15, 2008, 11:05:32 am »
Hi everyone ,

Can anyone tell me if im missing something, because my assigned variables dont show up in my rendered view , even the <?=TMVC_VERSION?> dont seem to show up.

Here is my code :
Code: [Select]
<?php

/**
 * default.php
 *
 * default application controller
 *
 * @package TinyMVC
 * @author Monte Ohrt
 */

class Default_Controller extends TinyMVC_Controller
{
  function 
index()
  {

    
$this->view->assign("hi","hello ?");
    
print_r($this);
    
$this->view->display('index_view');
    
  }
}

?>


This is what i get  + the html

Code: [Select]
Default_Controller Object
(
    [load] => TinyMVC_Load Object
        (
        )

    [view] => TinyMVC_View Object
        (
            [view_vars] => Array
                (
                    [hi] => hello ?
                )

        )

)


But my <?=$hi?> dont show up in the html, here is what i have when i print the php defined vars
Code: [Select]
Array
(
    [_tmvc_filepath] => C:\...
    [view_vars] =>
    [hi] => hello ?
)


view_vars are gone , is this normal ?

Im on Win Xp at work , PHP 5.2 , latest TinyMVC SVN revision , Checked out 15th August 2008

Thank you for the help , i apologize for my english , if im not clear enough i can try to give you more details .  :D

Pages: [1]