Jump to content

Archived

This topic is now archived and is closed to further replies.

coldkill

::SOLVED:: Class errror

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

Share this post


Link to post
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.

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
I tried doing $type = "" to give it a value in both functions but it didn't work.

Share this post


Link to post
Share on other sites
So what does $type contain in the calling file?

Try this to get the information
[code=php:0]echo '<pre>';
var_dump($type);
echo '</pre>';[/code]

Regards, Ben.



Share this post


Link to post
Share on other sites
It comes from a form and it contains the string "page_mod".

I really don't know why it's only this form which doesn't work with the system all the others do :S.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
I still need help with this one I can't seem to find the problem still.

Any ideas?
Cold

Share this post


Link to post
Share on other sites
::BUMP::
Still stuck and I really need the help.

Anyone got [b]ANY[/b] ideas?
Thanks,
Cold

Share this post


Link to post
Share on other sites

×

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.