Welcome Guest, Not a member yet? Register   Sign In
First Attempt failed misserably. Please help.
#1

[eluser]Unknown[/eluser]
Hi! I just downloaded, with great interest, the Cod3Igniter package. It is uploaded and ready to go!

I am following through the General Topics in the manual and attempted to perform the "Hello World" example with only a small modification - instead of calling it Blog, I called it Classmates.
Now when I correctly type the URI to that controller I get:


Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in ??????????????????.com/system/core/URI.php on line 141

I have blanked out the site's URI - the message didn't really contain all of those question marks!

Here is a copy of the controller code I created:

<?php
class Classmates extends CI_Controller {
function index()
{
echo 'Our Classmates';
}
}
/* End of file classmates.php */
/* Location: ./application/controllers/classmates.php */
?>


Unless I am mistaken, and since it is my first attempt I may well be......but, it sure looks like the same script as is in the User Guide (except with my names, etc.)

I'd sure appreciate anyone telling me what they might suggest for this. I'd really like to proceed further into CodeIgniter.

Thanks in advance for any suggestions.
Jeff
#2

[eluser]d1a8lo24[/eluser]
A few things make sure your config, has the right configurations. location: application/config/config.php

Now check the routes.php file and make sure that the default controller configuration "default_controller" is set to your controller. It should look like this $route['default_controller'] = "classmates"; Location: application/config/routes.php

After you make the changes make sure to reload if everything works that's it you're done and just make sure to read the users guide carefully.

If you still get the same problem try the following.
in the config file make sure that the $config['compress_output'] is set to false.
and last set the $config['uri_protocol'] in the same file to any of the available options.

Hope this helps
#3

[eluser]Twisted1919[/eluser]
Remove the ?> at the end of the script Smile
L.E: Also, add the constructor to your class.
#4

[eluser]d1a8lo24[/eluser]
Yes you should remove the "?>" at the end of your script, but you don't need the constructor for a simple echo.

The constructor is to load core classes from CI and to load libraries and helpers or to set variables that will be use throughout that particulars script.

This way you can use those classes and variables in any of your functions in that script.

But if you have the "?>" at the end of your script you should remove it.
#5

[eluser]Twisted1919[/eluser]
I recommended him to add the constructor just to keep a good practice .
#6

[eluser]Spir[/eluser]
I guess it's a bug related to phil fix yesterday :

https://bitbucket.org/ellislab/codeignit...bf5de0bde2

Try to set the uri_protocol in your config :
application/config/config.php
Code:
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'AUTO' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'            Default - auto detects
| 'PATH_INFO'        Uses the PATH_INFO
| 'QUERY_STRING'    Uses the QUERY_STRING
| 'REQUEST_URI'        Uses the REQUEST_URI
| 'ORIG_PATH_INFO'    Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol']    = '';
Or upgrade your codeigniter to the last version :
https://bitbucket.org/ellislab/codeignit.../downloads
#7

[eluser]Spir[/eluser]
The first thing you should do is check your server php version. You'll have that issue with PHP4 I'm pretty sure.
Quote:Support for PHP 4 is gone, PHP 5.1 is now a requirement.
#8

[eluser]Fmarie[/eluser]
I have the same problem
To resolve in my host, I have placed an .htaccess file and send into those words : SetEnv PHP_VER 5

Place it and that's all
#9

[eluser]Spir[/eluser]
[quote author="Fmarie" date="1297826950"]I have the same problem
To resolve in my host, I have placed an .htaccess file and send into those words : SetEnv PHP_VER 5

Place it and that's all[/quote]You are on OVH I guess. This how you set PHP5 on OVH server. It won't help other host I think.
#10

[eluser]Fmarie[/eluser]
Yes, you're right. I'm on OVH.
If my post can help someone, it's a pleasure therefore my first post was unused ^^




Theme © iAndrew 2016 - Forum software by © MyBB