vmichnowicz / vwm_polls

Free ExpressionEngine Poll Module and Fieldtype
Apache License 2.0
16 stars 8 forks source link

Unable to locate helper/Model error #6

Closed imjoshholloway closed 12 years ago

imjoshholloway commented 13 years ago

When first installing on a clean build of EE 2. Get the following error when trying to create a new channel field.

Unable to load the requested file: helpers/vwm_polls_helper.php

After some troubleshooting it turns out this is caused by the ft.vwm_polls.php file..

public function __construct()
{
    parent::__construct();

    // Load helper & model
    $this->EE->lang->loadfile('vwm_polls');
    $this->EE->load->helper('vwm_polls');
    $this->EE->load->model('vwm_polls_m');

    // Get member groups
    $this->member_groups();
}

Because the super object EE is loaded from the parent EE_Fieldtype class, the Loader class isn't looking in the module for the helper/Module files.

vmichnowicz commented 13 years ago

Ahh... interesting... I don't think I ever would have thought about that. I'll have to do some research to see why that would be messing things up. Appreciate the heads up :)

imjoshholloway commented 13 years ago

I thought this would be resolved by

public function __construct()
{
    $EE =& get_instance();

    // Load helper & model
    $EE->lang->loadfile('vwm_polls');
    $EE->load->helper('vwm_polls');
    $EE->load->model('vwm_polls_m');

    parent::__construct();

   // Get member groups
   $this->member_groups();
}

Because then the object is local, but it doesn't work. It must be something to do with the way EE parses loader class from within module files e.g mcp / mod / upd because a module I've created works fine with the $this->EE->load->helper.

Hopefully this helps too :)

ctHowie commented 13 years ago

Hey there - any resolution or other helpful findings come as a result of this? Thanks in advanced.

vmichnowicz commented 13 years ago

@ctHowie No, nothing yet - I have been pretty busy lately. Are you experiencing the same problem? What version of EE, installed modules, server, etc.. you have? If you are feeling adventurous you could probably wipe the line where I load the helper and replace it with a require_once. I'll try to get to this issue soon though. It is rather hard to debug though because I am unable to reproduce the problem.

ctHowie commented 13 years ago

Appreciate the response. Yes - I have found the same issue that was reported here ...we are on EE 2.1.0 - although are working on upgrading to 2.3 hopefully within the next couple of weeks (not under my control unfortunately).. - that could also have something to do with it. I'll take a closer look - but its hard for me to debug as where I work limits my access to the install files.. :-( Thanks again and if I uncover something I will certainly let you know!

vmichnowicz commented 13 years ago

I just pushed some code to my develop branch. Maybe this new code fixes the issue. If so, please report back :)

https://github.com/vmichnowicz/vwm_polls/commit/aa3284cefa334c4e2f0a3abc48a8e39a028bbea3

ctHowie commented 13 years ago

Thanks for the updated file. We tried it out and unfortunately the error is still persisting. :-( .

vmichnowicz commented 13 years ago

Really? Are you sure you tried the code from the develop branch? Cuz it should be throwing a different error if it is indeed failing with that code.

ctHowie commented 13 years ago

It might have been a different error.. now I don't remember. The person who works on my server already took the files down so I can't double check. Either way the error occurred at the same point when I tried to create a new custom field .. I am sorry I did not record the error I got to help you. :-(

vmichnowicz commented 12 years ago

I just updated the module to version 0.4.1. I ended up replicating the code used in the helper in the fieldtype. This should fix this issue.

rdhrkns commented 12 years ago

0.4.1 now throws the following: Unable to locate the model you have specified: vwm_polls_m

EE v2.3.1 - Build: date 20111017

vmichnowicz commented 12 years ago

@rdhrkns On what page are you receiving this error?

rdhrkns commented 12 years ago

When I try to install a new field in a field group for the channel I've set up.

vmichnowicz commented 12 years ago

I just installed and tested the module in EE 2.3.1 and did not encounter any errors. Are you sure you replaced all the module files? Sometimes, if working on a remote server, you may run into permission errors where it will skip files.

rdhrkns commented 12 years ago

I downloaded the latest here from Github, deleted the old files via FTP and uploaded the new files... I presume 775 grants sufficient acces for the files.

rdhrkns commented 12 years ago

Just double checked the procedure with the same result: 'Unable to locate the model you have specified: vwm_polls_m' when trying to ad a new field type to a group.

EE 2.3.1 poll_ft 0.4.1 poll_mod 0.4.1

vmichnowicz commented 12 years ago

@rdhrkns If you are available later we could try some remote support with Windows Remote Assistance or something similar. Send me a private message if interested.

rdhrkns commented 12 years ago

How / where do I contact you via PM ?

2012/1/11 Victor Michnowicz < reply@reply.github.com

@rdhrkns If you are available later we could try some remote support with Windows Remote Assistance or something similar. Send me a private message if interested.


Reply to this email directly or view it on GitHub: https://github.com/vmichnowicz/vwm_polls/issues/6#issuecomment-3449752

vmichnowicz commented 12 years ago

Haha, I guess there is no PM in GitHub. Just send an email then. My email is {my github username}@gmail.com

vmichnowicz commented 12 years ago

This should be fixed in the latest version of the code.