ruffsaint's avatar

PLS I NEED YOU GUYS HELP

Please am new to laravel and i can see this framework to be good but av been encountering lot of problem displaying my views

0 likes
14 replies
MThomas's avatar

There are a lot of things that might result in those problems. Can you tell us what you tried (show us the code and put them between code blocks (~~~ ~~~) and what errors you got?

And are you using Laravel 4 or Laravel 5?

If you are new to the framework I advise not to use Laravel 5 at this time, it is not yet officially released and badly documented so a lot of problems will come from it.

And @ruffsaint a lot of people here are willing to help, but using caps won't work (at least not in a positive way I guess). :)

RobinMalfait's avatar

We can't smell your problems, so be more specific and provide us all data needed:

  • code
  • Laravel version
  • expected
  • what you got

:)

1 like
ruffsaint's avatar
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_PARSE) 
syntax error, unexpected '>'

thats the error am getting from the browser

This my page:

<?php
 @section('main')
 <h1> All Users </h1>

 <p>{{ link_to_route('users.create', 'Add new user') }}</p>

 @if($users -> count())

 <table class="table table-striped table-bordered">
 <thead>
 <tr>
 <th>Username</th>
 <th>Password</th>
 <th>Email</th>
 <th>Phone</th>
 <th>Name</th>
 </tr>
 </thead>

 <tbody>
 @foreach($users as $user)
 <tr>
 <td>{{$user->username}}</td>
  <td>{{$user->password}}</td>
   <td>{{$user->email}}</td>
    <td>{{$user->phone}}</td>
     <td>{{$user->name}}</td>
     <td>{{link_to_route('users.edit', 'Edit', array($user->id), array('class'=>'btn btn-info'))}}</td>
     <td>
     {{Form::open(array('method' => 'DELETE', 'route' => array('users.destroy', $user->id)))}}
     {{Form::submit('Delete', array('class' => "btn btn-danger"))}}
     {{Form::close()}}
     </td>
 </tr>
 @endforeach
 </tbody>
 </table>
 @else
 There are no users
 @endif
 @stop
MThomas's avatar

@ruffsaint to let the codeblocks work you need to put a break before and after the ~~~ like this:

~~~
Put your code here
~~~
ruffsaint's avatar
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_PARSE) 
syntax error, unexpected '>'

this is the error i got

ruffsaint's avatar
<?php
 @section('main')
 <h1> All Users </h1>

 <p>{{ link_to_route('users.create', 'Add new user') }}</p>

 @if($users -> count())

 <table class="table table-striped table-bordered">
 <thead>
 <tr>
 <th>Username</th>
 <th>Password</th>
 <th>Email</th>
 <th>Phone</th>
 <th>Name</th>
 </tr>
 </thead>

 <tbody>
 @foreach($users as $user)
 <tr>
 <td>{{$user->username}}</td>
  <td>{{$user->password}}</td>
   <td>{{$user->email}}</td>
    <td>{{$user->phone}}</td>
     <td>{{$user->name}}</td>
     <td>{{link_to_route('users.edit', 'Edit', array($user->id), array('class'=>'btn btn-info'))}}</td>
     <td>
     {{Form::open(array('method' => 'DELETE', 'route' => array('users.destroy', $user->id)))}}
     {{Form::submit('Delete', array('class' => "btn btn-danger"))}}
     {{Form::close()}}
     </td>
 </tr>
 @endforeach
 </tbody>
 </table>
 @else
 There are no users
 @endif
 @stop

MThomas's avatar

@ruffsaint Can you update your post so the code is readable?

If you hover over your post, a pencil will show, click it to edit the post.

Does the error indicate a line?

thepsion5's avatar

You can't format method calls like this: $foo -> bar(). There has to be no whitespace, like so: $foo->bar().

1 like
MThomas's avatar

I figured it out, you need to change

 @if($users -> count())

to (without the spaces)

 @if($users->count())

__update: __ @thepsion5 you beat me to it ;)

1 like
bashy's avatar

You also don't need <?php in a blade file.

pmall's avatar

You need to have a minimum level of php skills to use laravel.

ruffsaint's avatar

Thanks Guys have fixed it. Its working now MThomas #thumbsUp

Please or to participate in this conversation.