Jump to content


Photo

::SOLVED:: Class errror


  • Please log in to reply
11 replies to this topic

#1 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 08 September 2006 - 02:15 PM

Hey folks,
I'm having some problems with a class I wrote to execute files and commands. It keeps giving out these errors
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)

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


You can learn alot from reading the manual

#2 °°Ben³

°°Ben³
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationGermany / Remagen

Posted 08 September 2006 - 02:17 PM

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

Sounds strange. Maybe you edit the wrong file?  ??? ^^ .. 

Maybe you can post the relevant code here? Thanks.
desktop and web development ;)
---
English is not my native language. Please excuse if I made some errors in expression.

#3 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 08 September 2006 - 03:13 PM

There's not much to it:
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;
	}
}
This is the part of the calling 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 );



You can learn alot from reading the manual

#4 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 08 September 2006 - 04:41 PM

$type === NULL

give it a value.

#5 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 08 September 2006 - 06:57 PM

I tried doing $type = "" to give it a value in both functions but it didn't work.


You can learn alot from reading the manual

#6 °°Ben³

°°Ben³
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationGermany / Remagen

Posted 08 September 2006 - 07:17 PM

So what does $type contain in the calling file?

Try this to get the information
echo '<pre>';
var_dump($type);
echo '</pre>';

Regards, Ben.




desktop and web development ;)
---
English is not my native language. Please excuse if I made some errors in expression.

#7 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 08 September 2006 - 07:37 PM

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.


You can learn alot from reading the manual

#8 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 08 September 2006 - 10:47 PM

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

Maybe it's the form:
<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>

Thanks,
Cold


You can learn alot from reading the manual

#9 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 08 September 2006 - 11:54 PM

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


You can learn alot from reading the manual

#10 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 09 September 2006 - 01:08 PM

I still need help with this one I can't seem to find the problem still.

Any ideas?
Cold


You can learn alot from reading the manual

#11 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 09 September 2006 - 09:47 PM

::BUMP::
Still stuck and I really need the help.

Anyone got ANY ideas?
Thanks,
Cold


You can learn alot from reading the manual

#12 coldkill

coldkill
  • Members
  • PipPipPip
  • Advanced Member
  • 159 posts
  • LocationUnited Kingdom

Posted 09 September 2006 - 10:53 PM

::SOLVED::


You can learn alot from reading the manual




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users