Jump to content

::SOLVED:: Class errror


coldkill

Recommended Posts

Hey folks,
I'm having some problems with a class I wrote to execute files and commands. It keeps giving out these errors
[code]WARNING [2] Missing argument 1 for action() (Line: 34 of /home/coldkill/public_html/beta/kernel/action.php)
WARNING [2] act(/home/coldkill/public_html/beta/source/action/files/.php): failed to open stream: No such file or directory (Line: 60 of /home/coldkill/public_html/beta/kernel/action.php)[/code]

Even though the argument is passed to the class (action) and the variable used in the require_once function has the correct value.

Both values being page_mod.

This doesn't happen with any other code this class executes just this one and I'm truely stumped.

Any ideas?
Thanks in advance,
Cold
Link to comment
Share on other sites

[quote author=coldkill link=topic=107352.msg430581#msg430581 date=1157724918]
Even though the argument is passed to the class (action) and the variable used in the require_once function has the correct value.[/quote]
Sounds strange. Maybe you edit the wrong file?  ??? ^^ .. 

Maybe you can post the relevant code here? Thanks.
Link to comment
Share on other sites

There's not much to it:
[code]class action extends main_class
{
/*----------------------------------------*/
// Constructor
/*----------------------------------------*/
/*
* @input $type
* @return NULL
*/
function action( $type )
{

/*
* INIT: DB
*/
$this->DB = new db_driver();


/*
* Execute the command
*/
$this->act( $type );
}

/*----------------------------------------------------*/
// Act
/*----------------------------------------------------*/
/*
* Executes the action
*/
function act( $type )
{
/*
* Get the file
*/
require_once( ROOT_PATH."source/action/files/".$type.".php" );

/*
* Start the action
*/
$this->ACTION = new $type;

/*
* Execute the file
*/
$this->ACTION->execute();

/*
* All done
*/
return TRUE;
}
}
[/code]
This is the part of the calling code:
[code]/*----------------------------------------*/
// Type?
/*----------------------------------------*/
if( ! empty( $_POST['type'] ) )
{
/*
* 'Twas a form!
*/
$type = $_POST['type'];
}
elseif( ! empty( $_REQUEST['type'] ) )
{
/*
* 'Twas a URL!
*/
$type = $_REQUEST['type'];
}
else
{
fatel_error( "There is no type of action to conduct. There may be an error with the form. Please contact the webmaster.", "Action init failed" );
}

/*----------------------------------------*/
// Start the action
/*----------------------------------------*/
$action = new action( $type );
[/code]
Link to comment
Share on other sites

Any more ideas on this one? Still don't have a clue.

Maybe it's the form:
[code]<form action="http://www.domain.com/beta/source/action/exec.php" method="post" name="editform" id="editform">
<table cellpadding="0" border="0" width="100%">


<tr>
<td>Title:</td>
<td><input name="title" type="text" class="inputhelp" value="" /></td>
</tr>
<tr>
<td></td>
<td><input id="use" type="text" value="Help" readonly="true" class="inputhelp" /></td>
</tr>
<tr>
<td>Text:</td>
<td><textarea name="post" class="inputarea"></textarea></td>
</tr>

<tr>
<td>Preview page?</td>
<td><input name="preview" id="preview" type="checkbox" onclick="javascript:Action()" value="checked" /></td>
</tr>
<tr>
<td>Link name*</td>
<td><input name="link" type="text" class="inputhelp" value="" /></td>
</tr>

<tr>
<td>Link Title**</td>
<td><input name="link_title" type="text" class="inputhelp" value="" /></td>
</tr>
<tr>
<td>Category***</td>
<td><select name="category">
  <option value="0" selected>-Select One-</option>

  <option value="1">AirLift</option><option value="2">Brief</option><option value="3">Community</option>
</select></td>
</tr>
<tr>
<td><input name="type" type="hidden" value="testy_blah_blah" /></td>
<td><input name="submit" type="submit" value="Submit" class="submitbutton"/></td>
</tr>

<tr>
<td></td>
<td>*This appears in the navigation bar and links to the page you are creating
<br />
**This appears when you hover over links in the navigation bar
<br />
***This is the category the link will appear under</td>
</tr>
</table>

</form>[/code]

Thanks,
Cold
Link to comment
Share on other sites

OK I set the initial values for the action.php functions to NULL and that's gotten rid of the first error message I got (same result as with = "").

But still the second error persists saying it can't include the page. I changed the global names to another one which was defined and it got rid of the include problem but gave me an error it couldn't instanitiate the class "page_mod" it did this for all the forms which previously worked fine.

Cold
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.