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.


Messages - ironm

Pages: [1] 2
1
Code: [Select]
class Example_Model
{
    protected $connectionOne;
    protected $connectionTwo;

    public function __construct()
    {
        $this->connectionOne = tmvc::instance()->controller->load->database('poolnameOne');
        $this->connectionTwo = tmvc::instance()->controller->load->database('poolnameTwo');
    }
}

2
Quote
server.com/~foo/admin/myapp/index.php/person was not found....

Is this the URI that you're trying to access? If so, then why do you have myapp in it?

If it's not the URI, then why do you have index.php in the file path?

3
Coding - Application Development / Re: Load a model within a model?
« on: November 19, 2013, 04:57:01 pm »
I don't know what is the purpose of your Person and SystemPlugins model to tell you whether it makes sense, but as I said, you should not try to load a model within a model. If you paste part of your code it will be easier to help you, but anyway, here are some examples.

One way will be as I said to create the two model instances in the controller, and send the one to the other.
Code: [Select]
class Example_Controller extends TinyMVC_Controller
{
...
    public function something()
    {
        // create an instance of the systems plugins model
        $this->load->model('SystemsPlugins_Model', 'systemsPlugins');

        // create an instance of the person model, and inject the system plugins model in its contructor
        $this->load->model('Person_Model', 'person', null, $this->systemsPlugins);

        // check whether to add of search
        $this->person->checkPerson();
        .
        .
        .
    }
...
}

Other way would be to get some value from the SystemsPlugins model to see whether you need to add or search, and then act on the Person model accordingly:
Code: [Select]
class Example_Controller extends TinyMVC_Controller
{
...
    public function something()
    {
        // create an instance of the systems plugins model
        $this->load->model('SystemsPlugins_Model', 'systemsPlugins');

        // create an instance of the person model, and inject the system plugins model in its contructor
        $this->load->model('Person_Model', 'person');

        // call the systems plugins method to see what you need to do
        $result = $this->systemsPlugins->checkWhatToDo();

        // let's suppose 1 is add, 2 is search
        switch ($result) {
            case 1:
                $this->person->addPerson();
                break;
            case 2:
                $this->person->searchPerson();
                break;
            default:
                // some error?
        }
        .
        .
        .
    }
...
}

I hope I understood you correctly on what you want to achieve, if I missed the point reply to me.

4
Coding - Application Development / Re: Load a model within a model?
« on: November 14, 2013, 10:28:57 am »
What are you trying to do in specific? Can you paste your code?

You should not try to load a model within a model (it's way too wrong), but instead you should create an instance of the specific model, and then send it from the controller to your other model. However, if you still want to do that, you can try loading the model by using the global instance (which is wrong, but anyway.. ).

Example of using the global instance:
Code: [Select]
class First_Model extends TinyMVC_Model
{
    public function doSomething()
    {
        // just a shortcut
        $global = tmvc::instance()->controller;

        // load the second model within the first one
        $global->load->model('second_model', 'second');

        // call a method from the second model
        $result = $global->second->returnSomething();
    }
}

5
Bug Reports / Re: UTF-8 vs UTF8
« on: June 03, 2013, 11:56:49 am »
Are you sure it is TinyMVC issue? Have you checked your database tables encoding?

6
Coding - Application Development / Re: sub-template
« on: May 27, 2013, 10:08:53 am »
EDIT: I have just noticed that this thread is actually 5 years old, but I'll leave the answer as it may help to someone.

nah still nothing,
i think method index() in slave controller isn't starting
when slave view is included to master view probable only master controller is execute
so that's why i cant retrieve variables from slave controller and i have no idea how to change that ;)

I think that you do not quite understand the TinyMVC architecture. How do you expect the slave_view to have variables from slave_controller, when slave_controller is never called? The view will not call the controller, this is not Symfony.

Quote
i want it make work like this http://www.symfony-project.org/book/1_0/07-Inside-the-View-Layer

What specifically do you need to be implemented from the above link? These are just helper functions, which you can implement it yourself. And about the layout view, mohrt gave you a good example:

controller.php
Code: [Select]
$this->view->assign('div_content', 'It works!');
$this->view->assign('content', $this->view->fetch('content_view'));
$this->view->display('layout_view');

content_view.php
Code: [Select]
<div><?php echo $div_content?></div>
layout_view.php
Code: [Select]
<html>
<head>
<title>Title</title>
</head>
<body>
    <?php echo $content?>
</body>
</html>

7
Coding - Application Development / Re: 1.2.3 released
« on: May 04, 2013, 01:30:58 pm »
Ok, thanks.

8
Coding - Application Development / Re: 1.2.3 released
« on: May 04, 2013, 06:27:50 am »
Wow, what a bummer. Would you mind if the framework is forked?

9
Coding - Application Development / Re: Issues to get started
« on: March 28, 2013, 03:26:23 pm »
Hi Blue Jester,

While TinyMVC is really tiny and easy, it has its own issues. Probably the biggest one is that is has no community to rely on. As you can see I am writing the first reply to your question after 5 days. So, while it is easy to start working, it is really intuitive, and it is not full with stuff that you do not actually need, you will not have any support during the development of whatever you are doing. The only one that was giving answers on the forum was the creator of the framework (also creator of http://www.smarty.net/), but he is probably doing other more interesting things in his life right now, so he does not have so much time. So, I would suggest to you to take a look at other frameworks with bigger community such as Codeigniter (which is very similar to TinyMVC, and you can get a quickstart at it), and also other wonderfull frameworks as the ones you mentioned. But, I suggest Codeigniter because of the similarity.

As far as your question, you have done everything great, but the reason why there is no fatal error when you remove the semicolon is because the file "hello.php" is never accessed. There was a bug in 1.2.2 version, and one user reported it, so I would suggest for you to take a look at the SVN for the changes (because a new version has not been released almost an year).

In detail, in file /tinymvc/sysfiles/TinyMVC.php change line
Code: [Select]
if(!file_exists($controller_file))to
Code: [Select]
if(!stream_resolve_include_path($controller_file))
It should work now, but as I said I would suggest to take a look at the SVN for other changes in the code.

10
Bug Reports / TinyMVC_Load model method
« on: January 23, 2013, 01:01:07 pm »
I was trying to organize my model files in folders, but I cannot achieve that because of the way TinyMVC includes the files. But then I tried to explicitly say where is the file, through the load->model method, and it does not work. If I write:
Code: [Select]
$this->load->model('Thread_Model', 'thread', 'forum/thread_model.php');then it says to me that the class cannot be loaded.

When I looked at the code in TinyMVC_Load model method, it seems that the $filename variable is never used, although it is initialized. Am I missing something?

11
TinyMVC Framework Development / Re: TinyMVC 1.2.2 sysfiles
« on: July 25, 2012, 05:21:41 pm »
You are right about the autoloader. Anyway, thanks for the fix.

12
TinyMVC Framework Development / Re: TinyMVC 1.2.2 sysfiles
« on: July 25, 2012, 04:58:43 am »
Well... I don't know...That's what I mentioned this issue. Try to download the 1.2.2 package from the website, and see what's in the sysfiles folder. The last time I checked the download, there was a configs folder in it that had three files: config_application.php, config_autoload.php, config_database.php. And then, as I previously said, the TinyMVC.php file takes the configuration settings from the ./sysfiles/configs folder, and not from the ./myapps/configs folder.

13
TinyMVC Framework Development / Re: TinyMVC 1.2.2 sysfiles
« on: July 08, 2012, 06:12:27 am »
I am talking more specificaly about the controllers, models and configs folders in the sysfiles folder. I am not talking about the files. The folders seems to be empty (except the configs folders), and that's why I asked what is their purpose.

Another point to be mentioned would be the purpose of the configs folders in myapp, since now TinyMVC.php file takes the configuration settings from the ./tinymvc/sysfiles/configs folder. In other words, the configs folder in myapp is now useless.

14
TinyMVC Framework Development / TinyMVC 1.2.2 sysfiles
« on: July 06, 2012, 06:36:04 am »
What is actually the purpose for having the controllers, models, config folders in the sysfiles in this version? How are they going to be used?

EDIT: These folders actually don't exist in the SVN.

15
TinyMVC Framework Development / Re: Implementing session handler
« on: June 29, 2012, 10:48:13 am »
I don't know if you managed to solve the issue, but it may be possible that you copied what mohrt wrote and that's why it's not working for you. Mohrt did a little mistake when telling you what to write in the constructor, so instead of adding
Code: [Select]
__parent::construct();you should add
Code: [Select]
parent::__construct(); It should work fine this way...

Pages: [1] 2