• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI - Nettuts+ Day 4 - Error, but code looks the same

Hi, I've tried to look for other occurrences of this same issue. I'm following along on the great tuts by Jeffrey Way and I've come across an obstacle.

This is the error that I receive:

( ! ) Parse error: syntax error, unexpected T_IF in C:\wamp\www\ci\application\controllers\emailnewsletter.php on line 31
Call Stack
#    Time    Memory    Function    Location
1    0.0011    695808    {main}( )    ..\index.php:0
2    0.0033    777680    require_once( 'C:\wamp\www\ci\system\core\CodeIgniter.php' )    ..\index.php:198

This is the code that I have:


class Emailnewsletter extends CI_Controller {

    function __construct() {
    function index() {
    function send() {
        $this->email->from('[email protected]', 'Kris Small');
        $this->email->to('[email protected]');
        $this->email->subject('This is an email test');
        $this->email->message('It is working!!  Here is your file.');
        $path = $this->config->item('server_root');
        $file = $path . 'c://wamp/www/ci/attachments/yourinfo.txt'
        if($this->email->send()) {
            echo 'Your email was sent, maaaaaan';
        else {

A couple differences are the name of the file and I actually was receiving an error when sending the emails through googlemail (but it works when using gmail in its place). The original error message referred to the commented out code (//$this->email->attach($file)Wink but then I saw that Jeffrey Way commented that out but then the errors just move down the lines of code. Is there any errata or am I missing something simple?


Just a missing semi-colon:

        $file = $path . 'c://wamp/www/ci/attachments/yourinfo.txt'; // <-- missing here

Thank you very much. You think you check for all the simple things....

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.