News tutorial help needed |
[eluser]Atown[/eluser]
So 3 days latter, 4 attempts at the tutorial, and 2 pages of forum posting searches and I'm finally registered and posting for help. I've used Wordpress and Drupal for a long time but I'm really trying to learn more how this kind of stuff works and operates. So here is the url: http://loadersequence.com/ci/index.php/news routes: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); model: Code: <?php Code: <?php View Code: <?php I'm extremely grateful for the help and really just kind of frustrated because I know I'm not that ignorant and everyone keeps saying these tutorials and userguide are awesome but I've been struggling with CI for a couple weeks and made it through most things but just this basic blog thing has gotten me stumped.
[eluser]CroNiX[/eluser]
You posted everything except for what the actual problem is. What specifically isn't working? Your routes shouldn't start with a /. It should just be "controller/method/params" Code: $route['news/(:any)'] = '/news/view/$1'; //'news/view/$1' Also, if your /application dir isn't in its default location (same level as index.php), this line will need to be changed: Code: if ( ! file_exists('application/views/pages/'.$page.'.php')) Code: if ( ! file_exists(APPPATH . 'views/pages/'.$page.'.php'))
[eluser]Atown[/eluser]
[quote author="CroNiX" date="1349891690"]You posted everything except for what the actual problem is. What specifically isn't working?[/quote] Thats what the link was for ![]() its error 500 and nothing operates outside of the index.php page Quote:Your routes shouldn't start with a /. It should just be "controller/method/params" fixed ![]() Quote:Also, if your /application dir isn't in its default location (same level as index.php), this line will need to be changed: could you elaborate why that works? not that i dotn believe that it solves stuff but I'm really trying to learn this stuff and honestly curious still returning error 500
[eluser]CroNiX[/eluser]
Sorry, I don't usually follow links. If it's not all in one easy location I generally skip it. Look at the bottom of index.php where it defines CI's paths. APPPATH is dynamically generated and it won't matter where the /application folder is located (it's best to keep /application and /system out of root for security). If you hardcode the application path (and it's a relative path - like it is in the tutorial) and move your /application dir outside of root, it will break unless you use the predefined constants. It's just best to use the constants so you don't have anything to update (except index.php) if your application moves locations. Based on that 404 page (I don't see 500 error) and the message it supplies, and the fact you get it if you also go to the home controller: http://loadersequence.com/ci/index.php and also the root of your site: http://loadersequence.com I'd say it's your hosting doing this and nothing to do with CI. Are you sure your host is properly set up? Does it work from localhost?
[eluser]Atown[/eluser]
[quote author="CroNiX" date="1349892673"]Sorry, I don't usually follow links. If it's not all in one easy location I generally skip it. [/quote] Yeah... I hear ya. [quote author="CroNiX" date="1349892673"] Look at the bottom of index.php where it defines CI's paths. APPPATH is dynamically generated and it won't matter where the /application folder is located (it's best to keep /application and /system out of root for security). If you hardcode the application path (and it's a relative path - like it is in the tutorial) and move your /application dir outside of root, it will break unless you use the predefined constants. It's just best to use the constants so you don't have anything to update (except index.php) if your application moves locations.[/quote] makes sense. [quote author="CroNiX" date="1349892673"] Based on that 404 page (I don't see 500 error) and the message it supplies, and the fact you get it if you also go to the home controller: http://loadersequence.com/ci/index.php [/quote] mmmm weird im not sure we're looking at the same thing. me clicking that link works just fine it shows: Quote:CodeIgniter 2 Tutorial Chrome with for the news section returns : Quote:Server error While firefox turns up a blank page. Quote:I'd say it's your hosting doing this and nothing to do with CI. Are you sure your host is properly set up? Does it work from localhost? my host is a small hosting co. and so I dont enough have cpanel. Its basically just phpmyadmin and ftp access. its $2.50 a mo though so i dont mind too much. Localhost i dont have a test xamp server setup, just because my laptop is on its last 2gb.... I'm trying to hold out for black friday for more storage ![]() Quote:Based on that 404 page (I don’t see 500 error) and the message it supplies, and the fact you get it if you also go to the home controller: http://loadersequence.com/ci/index.php and also the root of your site: http://loadersequence.com I was trying to make the /ci/ the root that I was working. I use loadersequence as a testing ground for a lot of different projects.
[eluser]CroNiX[/eluser]
I get a 404 from 1&1 hosting on each of your links when I click on them. When going to your homepage, it shows a generic 1&1 landing page saying your domain was just set up and "click here" to see how to set your site up. It is indeed coming from 1&1 hosting. If you've recently set up the domain, it's possible it hasn't propagated via all of the nameservers yet.
[eluser]Atown[/eluser]
hmmm then i'm just waiting on some propogation. Had to flush dns on my end so I could actually see those >_<
[eluser]Atown[/eluser]
good morning ![]() Anywho, stuff has propogated and no difference on my end but hopefully you'll be able to see stuff now.
[eluser]Aken[/eluser]
You need to make sure to call the parent construct in your models. Code: class News_model extends CI_Model { Your controller also looks malformed (missing curly braces to close methods). You are also defining the view() method more than once. Also, if you have an .htaccess file to remove index.php, I suggest you take it out for the time being, as it is often the cause of 500 server errors. Otherwise it could be the PHP errors causing problems.
[eluser]Atown[/eluser]
[quote author="Aken" date="1350013972"]You need to make sure to call the parent construct in your models. Code: class News_model extends CI_Model { Your controller also looks malformed (missing curly braces to close methods). You are also defining the view() method more than once. Also, if you have an .htaccess file to remove index.php, I suggest you take it out for the time being, as it is often the cause of 500 server errors. Otherwise it could be the PHP errors causing problems.[/quote] Awesome so it was a missing curly bracket and the fact that I called two views, even though the view was ($slug)... and I followed the tutorial.... how come the tutorial had me call that view in addition to the other? I then got a invalid db error "You have specified an invalid database connection group." which I troubleshooted into the config/database.php and changing the Quote:$active_group = 'default';to default (it was set to "test" for whatever reason. I think it was from another issue on stackoverflow I was trying to use to help figure out my other issues.) Thank you for your help everyone, I really appreciate getting back on track with this |
Welcome Guest, Not a member yet? Register Sign In |