PDA

View Full Version : Help from Acedeal!


Father-Time.
June 5th, 2003, 16:12
Hi Ace,
Need a little help if poss?
can you see anything wrong with this line?
$post_functions = new post_functions(&$this);
Fatal error: Cannot instantiate non-existent class: post_functions in /home/www/Sactonzo/forums/sources/Post.php on line 277


Thanks in advance

Sel

Father-Time.
June 5th, 2003, 16:25
Doh!!!

Never mind i found the offending "Space". Stupid i is!?!?!?!

Thanks anyway

Sel

Acedeal
June 6th, 2003, 03:17
Hi Ace,
Need a little help if poss?
can you see anything wrong with this line?
$post_functions = new post_functions(&$this);
Fatal error: Cannot instantiate non-existent class: post_functions in /home/www/Sactonzo/forums/sources/Post.php on line 277


Thanks in advance

Sel

When posting PHP, try and use the PHP tags,
It helps when debuggin..example

[php:1:9e39d6cf4d]
$post_functions = new post_functions(&$this);
// Fatal error: Cannot instantiate non-existent class: post_functions in /home/www/Sactonzo/forums/sources/Post.php on line 277


[/php:1:9e39d6cf4d]

Fatal error: Cannot instantiate non-existent class: post_functions in /home/www/Sactonzo/forums/sources/Post.php on line 277

It helps highlight the syntax a little better then just the [ code tags..

Acedeal
June 6th, 2003, 03:21
A better example

This is hard to debug;



<?php
<html>
<head>
<title>-=DoW=- Recruiting Forms</title>
<link rel="stylesheet" href="css/pof/green.css" type="text/css">
</head>
<bgcolor="#000000">
<body>
<div align="center">
<?php

require "lib/FormProcessor.class.php";
include "inc/countries.inc.php";

// Initialize
$fp = new FormProcessor("lib/");

// Import the needed elements
$fp->importElements(array(
FPText, FPTextField, FPTextArea, FPPassword, FPSelect,
FPFile, FPCheckBox, FPRadio, FPSubmitButton,
'extra/FPConfirmPassword'
));
$fp->importLayouts(array( FPColLayout, FPRowLayout, FPGridLayout, FPGroup ));
$fp->importWrappers(array( FPLeftTitleWrapper ));


// Create the form object
$myForm = new FPForm(array(
title => '-=DoW=- Recruiting',
name => 'myForm',
action => $PHP_SELF,
display_outer_table => true,
refine_owners => true,
table_align => 'center',
table_width => '500'
));


// Wrappers
$leftWrapper = new FPLeftTitleWrapper(array());



//$WEAPONS = ;

// Construct a grid of radio elements
$radioGrid = new FPGridLayout(array(
table_padding => 7,
columns => 3,
));


$i = 0;
foreach (
array(
'SVD', 'M24', 'M82', 'MOS',
'M16', 'Nade Laucher', 'Saw')
as $weapon
)
$radioGrid->addElement(
new FPRadio(
array(
group_name => 'radio_group',
item_value => $i,
title => $weapon,
checked => ($i++ == 0)
))
);


// Construct a grid of checkbox elements
$checkboxGrid = new FPGridLayout(array(
table_padding => 5,
columns => 2,
));

$i = 0;
foreach (
array(
'DoW_1','DoW_II','DoW_III','DoW_IV','DOW_V','DOW_V I',
'DOW_VII','Homelan','Other Private Servers','Only -=DoW=-' )
as $server
)
$checkboxGrid->addElement(
new FPCheckBox(
array(
name => 'checkbox'.$i,
title => $server,
table_align => 'left',
table_padding => 0,
checked => (++$i)%2,
comment => 'Check it if you if you play on it!'
))
);


// Password field
// We have to create an explicit reference to this object to use it
// in the FPConfirmPassword object constructor
$passwordField = new FPPassword(
array(
name => 'password',
title => 'Password',
required => true,
size => 20,
valid_RE => FP_VALID_PASSWORD,
max_length => 36,
wrapper => &$leftWrapper,
comment =>
'Password is case sensitive and must be '.
'at least 6 characters!'
));


// Define form elements
$myForm->setBaseLayout(

new FPColLayout(array(

table_padding => 5,
element_align => center,
elements => array(

new FPText(
array(
text =>
'<div align="left">'.
'Please, fill in the following fields.'.'<br>'.
'Read the comments carefully before submitting '.
'your data!'.
'</div>'
)),


new FPGroup(array(
title => '-=DoW=- <br>Recruiting Application',
elements => array(new FPRowLayout(array(
elements => array(
new FPTextField(array(
name => forum_name,
title => 'Forum_Name',
wrapper => &$leftWrapper,
size => 20,
css_style => 'width:150px;',
required => true,
max_length => 256
)),

),
comment =>
'You first need to '.
'<a href="/forum/profile.php?mode=register&sid=b869f3bf803a1a4a960852e56d095beflogin.php">'.
'have a Forum Account'.
'</a> '.
'before sending<br>an Application to Recruitment'
))),
)),

new FPTextField(
array(
name => 'game_name',
title => 'Game Name',
required => true,
size => 33,
max_length => 256,
wrapper => &$leftWrapper
)),



new FPTextField(
array(
name => 'email',
title => 'E-mail Address',
comment => 'We do not Accept any Applications from @yahoo or @hotmail Accounts'.
' or any other Free Email Type Accounts.'.
'<br>'.
'You will need to have a Real Email Account',
required => true,
size => 33,
max_length => 256,
wrapper => &$leftWrapper
)),

new FPTextField(
array(
name => 'first_name',
title => 'First Name',
comment =>
'First name must be shorter than 36 '.
'symbols and start with a letter',
required => true,
size => 25,
max_length => 36,
wrapper => &$leftWrapper
)),

new FPTextField(
array(
name => 'last_name',
title => 'Last Name',
required => true,
size => 25,
valid_RE => FP_VALID_NAME,
max_length => 36,
wrapper => &$leftWrapper,
)),

new FPSelect(
array(
name => 'country',
title => 'Your Country',
multiple => false,
options => $COUNTRIES,
selected => array("RUS"),
css_style => 'width:200px;',
wrapper => &$leftWrapper
)),

new FPSelect(
array(
name => 'favourite_countries',
title => 'Your Favourite Countries',
multiple => true,
min_options_selection => 2,
max_options_selection => 4,
comment => 'You must select between 2 and 4 options',
options => $COUNTRIES,
selected => array("GBR"),
css_style => 'width:200px;',
wrapper => &$leftWrapper
)),

new FPGroup(
array(
title => 'Choose Your Favourite Weapon',
table_align => center,
table_padding => 7,
elements => array(
&$radioGrid
)
)),

new FPTextArea(
array(
name => 'comments',
title => 'Reason Why you Think you would be a good fit in -=DoW=-',
max_length => 2048,
required => true,
wrapper => &$leftWrapper
)),

new FPGroup(
array(
title => 'What Server or Servers do you Normally Play on',
table_align => center,
table_padding => 7,
elements => array(
&$checkboxGrid,
)
// )),
//
//new FPFile(
//array(
//name => 'image',
// title => 'Your Image (optional)',
//size => '20',
/* destination_file =>
'/var/www/html/tests/pof/upload/upload.gif', */
//allowable_content_types => array('image/gif'),
//max_file_size => 20480,
//wrapper => &$leftWrapper,
//comment =>
//'Only GIF images with size less than 20K '.
//'are allowed for uploading'
)),

new FPCheckBox(
array(
name => 'subscribe_chkbox',
title => 'Have you Read and Understand all of -=DoW=- Rules',
table_align => 'center',
checked => False
)),

new FPRowLayout(array(
table_align => center,
table_padding => 20,
elements => array(
new FPSubmitButton(
array(
name => 'submit',
title => ' Submit '
)),
)
)),

)
))
);


// Obtain submitted data and check the values correctness
if ($myForm->getSubmittedData() && $myForm->isDataValid()) {

$elements = $myForm->getElementValues();
echo
'<div align="left">'.
'Thank you, your data is valid!'.
'<pre>'
;
var_dump($elements);
echo
'</pre>'.
'</div>';
} else
$myForm->display();

?>
</div>
</body>
</html>


And using the php tags makes it much easier..
same code using the php tags
[php:1:5966474cb8]
<?php
<html>
<head>
<title>-=DoW=- Recruiting Forms</title>
<link rel="stylesheet" href="css/pof/green.css" type="text/css">
</head>
<bgcolor="#000000">
<body>
<div align="center">
<?php

require "lib/FormProcessor.class.php";
include "inc/countries.inc.php";

// Initialize
$fp = new FormProcessor("lib/");

// Import the needed elements
$fp->importElements(array(
FPText, FPTextField, FPTextArea, FPPassword, FPSelect,
FPFile, FPCheckBox, FPRadio, FPSubmitButton,
'extra/FPConfirmPassword'
));
$fp->importLayouts(array( FPColLayout, FPRowLayout, FPGridLayout, FPGroup ));
$fp->importWrappers(array( FPLeftTitleWrapper ));


// Create the form object
$myForm = new FPForm(array(
title => '-=DoW=- Recruiting',
name => 'myForm',
action => $PHP_SELF,
display_outer_table => true,
refine_owners => true,
table_align => 'center',
table_width => '500'
));


// Wrappers
$leftWrapper = new FPLeftTitleWrapper(array());



//$WEAPONS = ;

// Construct a grid of radio elements
$radioGrid = new FPGridLayout(array(
table_padding => 7,
columns => 3,
));


$i = 0;
foreach (
array(
'SVD', 'M24', 'M82', 'MOS',
'M16', 'Nade Laucher', 'Saw')
as $weapon
)
$radioGrid->addElement(
new FPRadio(
array(
group_name => 'radio_group',
item_value => $i,
title => $weapon,
checked => ($i++ == 0)
))
);


// Construct a grid of checkbox elements
$checkboxGrid = new FPGridLayout(array(
table_padding => 5,
columns => 2,
));

$i = 0;
foreach (
array(
'DoW_1','DoW_II','DoW_III','DoW_IV','DOW_V','DOW_V I',
'DOW_VII','Homelan','Other Private Servers','Only -=DoW=-' )
as $server
)
$checkboxGrid->addElement(
new FPCheckBox(
array(
name => 'checkbox'.$i,
title => $server,
table_align => 'left',
table_padding => 0,
checked => (++$i)%2,
comment => 'Check it if you if you play on it!'
))
);


// Password field
// We have to create an explicit reference to this object to use it
// in the FPConfirmPassword object constructor
$passwordField = new FPPassword(
array(
name => 'password',
title => 'Password',
required => true,
size => 20,
valid_RE => FP_VALID_PASSWORD,
max_length => 36,
wrapper => &amp;$leftWrapper,
comment =>
'Password is case sensitive and must be '.
'at least 6 characters!'
));


// Define form elements
$myForm->setBaseLayout(

new FPColLayout(array(

table_padding => 5,
element_align => center,
elements => array(

new FPText(
array(
text =>
'<div align="left">'.
'Please, fill in the following fields.'.'
'.
'Read the comments carefully before submitting '.
'your data!'.
'</div>'
)),


new FPGroup(array(
title => '-=DoW=-
Recruiting Application',
elements => array(new FPRowLayout(array(
elements => array(
new FPTextField(array(
name => forum_name,
title => 'Forum_Name',
wrapper => &amp;$leftWrapper,
size => 20,
css_style => 'width:150px;',
required => true,
max_length => 256
)),

),
comment =>
'You first need to '.
'<a href="/forum/profile.php?mode=register&sid=b869f3bf803a1a4a960852e56d095beflogin.php">'.
'have a Forum Account'.
'</a> '.
'before sending
an Application to Recruitment'
))),
)),

new FPTextField(
array(
name => 'game_name',
title => 'Game Name',
required => true,
size => 33,
max_length => 256,
wrapper => &amp;$leftWrapper
)),



new FPTextField(
array(
name => 'email',
title => 'E-mail Address',
comment => 'We do not Accept any Applications from @yahoo or @hotmail Accounts'.
' or any other Free Email Type Accounts.'.
'
'.
'You will need to have a Real Email Account',
required => true,
size => 33,
max_length => 256,
wrapper => &amp;$leftWrapper
)),

new FPTextField(
array(
name => 'first_name',
title => 'First Name',
comment =>
'First name must be shorter than 36 '.
'symbols and start with a letter',
required => true,
size => 25,
max_length => 36,
wrapper => &amp;$leftWrapper
)),

new FPTextField(
array(
name => 'last_name',
title => 'Last Name',
required => true,
size => 25,
valid_RE => FP_VALID_NAME,
max_length => 36,
wrapper => &amp;$leftWrapper,
)),

new FPSelect(
array(
name => 'country',
title => 'Your Country',
multiple => false,
options => $COUNTRIES,
selected => array("RUS"),
css_style => 'width:200px;',
wrapper => &amp;$leftWrapper
)),

new FPSelect(
array(
name => 'favourite_countries',
title => 'Your Favourite Countries',
multiple => true,
min_options_selection => 2,
max_options_selection => 4,
comment => 'You must select between 2 and 4 options',
options => $COUNTRIES,
selected => array("GBR"),
css_style => 'width:200px;',
wrapper => &amp;$leftWrapper
)),

new FPGroup(
array(
title => 'Choose Your Favourite Weapon',
table_align => center,
table_padding => 7,
elements => array(
&amp;$radioGrid
)
)),

new FPTextArea(
array(
name => 'comments',
title => 'Reason Why you Think you would be a good fit in -=DoW=-',
max_length => 2048,
required => true,
wrapper => &amp;$leftWrapper
)),

new FPGroup(
array(
title => 'What Server or Servers do you Normally Play on',
table_align => center,
table_padding => 7,
elements => array(
&amp;$checkboxGrid,
)
// )),
//
//new FPFile(
//array(
//name => 'image',
// title => 'Your Image (optional)',
//size => '20',
/* destination_file =>
'/var/www/html/tests/pof/upload/upload.gif', */
//allowable_content_types => array('image/gif'),
//max_file_size => 20480,
//wrapper => &amp;$leftWrapper,
//comment =>
//'Only GIF images with size less than 20K '.
//'are allowed for uploading'
)),

new FPCheckBox(
array(
name => 'subscribe_chkbox',
title => 'Have you Read and Understand all of -=DoW=- Rules',
table_align => 'center',
checked => False
)),

new FPRowLayout(array(
table_align => center,
table_padding => 20,
elements => array(
new FPSubmitButton(
array(
name => 'submit',
title => ' Submit '
)),
)
)),

)
))
);


// Obtain submitted data and check the values correctness
if ($myForm->getSubmittedData() &amp;&amp; $myForm->isDataValid()) {

$elements = $myForm->getElementValues();
echo
'<div align="left">'.
'Thank you, your data is valid!'.
'<pre>'
;
var_dump($elements);
echo
'</pre>'.
'</div>';
} else
$myForm->display();

?>
</div>
</body>
</html>
[/php:1:5966474cb8]

-=DoW=- SmokieRat
June 6th, 2003, 03:24
Oooh, preetttyyyy :shock:

Acedeal
June 6th, 2003, 03:25
looking at his post gave me an idea of using the php tags in my sig to auto highlight my little saying :)

Father-Time.
June 6th, 2003, 03:38
Cool, never knew that Ace, Thanks.

Seems to be oj now though.

Will use the php tags in furture :D