This is probably going to be simple, but it’s driving me nuts!
I am using SMOF options in a theme, works brilliantly but got one tiny issue with echo’ing variables in a PHP Class e.g
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']);
This doesn’t work, but if I do:
<?php echo $data['db_email']; ?>
It outputs the data stored, so how do I do the echo inside the class. e.g.
$uploader = new DropboxUploader(echo $data['db_email'], echo $data['db_pass']);
But obviously this doesn’t work!
Thanks in advance
Have you tried set your parameters after creating instance of the class?
Gareth_Gillman said
This is probably going to be simple, but it’s driving me nuts!I am using SMOF options in a theme, works brilliantly but got one tiny issue with echo’ing variables in a PHP Class e.g
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']);This doesn’t work, but if I do:
<?php echo $data['db_email']; ?>It outputs the data stored, so how do I do the echo inside the class. e.g.
$uploader = new DropboxUploader(echo $data['db_email'], echo $data['db_pass']);But obviously this doesn’t work!
Thanks in advance
First you have to create the instance of that class and echo that value with the help of reference..I your case
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']); echo $uploader->method_name/class variables as you want
freevision said
Have you tried set your parameters after creating instance of the class?
I mean probably your parameters not passing, echo your incoming parameters in class/function.
RelStudios said
Gareth_Gillman said
This is probably going to be simple, but it’s driving me nuts!I am using SMOF options in a theme, works brilliantly but got one tiny issue with echo’ing variables in a PHP Class e.g
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']);This doesn’t work, but if I do:
<?php echo $data['db_email']; ?>It outputs the data stored, so how do I do the echo inside the class. e.g.
$uploader = new DropboxUploader(echo $data['db_email'], echo $data['db_pass']);But obviously this doesn’t work!
Thanks in advanceFirst you have to create the instance of that class and echo that value with the help of reference..I your case
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']); echo $uploader->method_name/class variables as you want
Think I may have confused you guys, the instances I showed are for a username and password, which don’t need to be echo’d BUT they do need to be utilised by the class.
The login script isn’t working, as the user and pass aren’t being set in the class,
I can add the user and pass in the class, like so:
$uploader = new DropboxUploader('email@address.com', 'password');
This works fine, and I can also use php $_POST and it works but I am trying to utilise the admin panel from SMOF to allow the user to set this data.
Tried something like (string)$data[“db_email”] ? And I prefer to check echo result on “view source”
Gareth_Gillman said
RelStudios said
Gareth_Gillman said
This is probably going to be simple, but it’s driving me nuts!I am using SMOF options in a theme, works brilliantly but got one tiny issue with echo’ing variables in a PHP Class e.g
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']);This doesn’t work, but if I do:
<?php echo $data['db_email']; ?>It outputs the data stored, so how do I do the echo inside the class. e.g.
$uploader = new DropboxUploader(echo $data['db_email'], echo $data['db_pass']);But obviously this doesn’t work!
Thanks in advanceFirst you have to create the instance of that class and echo that value with the help of reference..I your case
$uploader = new DropboxUploader($data['db_email'], $data['db_pass']); echo $uploader->method_name/class variables as you wantThink I may have confused you guys, the instances I showed are for a username and password, which don’t need to be echo’d BUT they do need to be utilised by the class.
The login script isn’t working, as the user and pass aren’t being set in the class,
I can add the user and pass in the class, like so:
$uploader = new DropboxUploader('email@address.com', 'password');This works fine, and I can also use php $_POST and it works but I am trying to utilise the admin panel from SMOF to allow the user to set this data.
Still can’t get this to work, after trying other things
Now using:
$db_email = $data['db_email']; $db_pass = $data['db_pass']; $uploader = new DropboxUploader($db_email, $db_pass);
If I echo the 2 strings, they display the contents, but won’t work in the class.
It’s gotta be something so simple to fix but I am stumped,
Open the dropbox uploader class, find it’s __construct function, echo the parameters that is passed too see what is output. Once we know the answer to that it’ll be a lot easier to debug.
I am using this class, and I haven’t modified the DropboxUploader.php file.
echo 'Email:' , $data['db_email'] , ', Password:' , $data['db_pass'];
