Simple question/issue...new to CodeIgniter |
[eluser]codelogic[/eluser]
Hi all, I am very new to CodeIgniter, but I would consider myself pretty skilled with PHP. Since I am new, I thought a good place to start would be the User Guide tutorial for creating a News Page. http://ellislab.com/codeigniter/user-gui...ction.html However, I am having a very annoying issue that I cannot get fixed. When I fill out my news form (with a title and text) and hit the "Create news item" button on the form, it redirects me to http://[my-site-url]/CI/index.php/news/create/[my-site-url]/CI/index/news/create/ with a 404 error. It seems to be copying and pasting my URL into the address bar without deleting the previous address. Could it be that I am not connecting to the database correctly? I am almost positive that I am connecting correctly as I have quadruple checked my login info to make sure it was right. Here is my code it's fairly simple and right from the tutorial... all I have is a 1 model, 4 views, and 1 controller. If anyone can figure out why this weird mistake is happening with my URL I would be very happy. Thanks!! Edit: Fixed!! Had to add http:// to my base_url. Edit 2: Running into a second problem where I want to view a single article, however it redirects me to index.php/news/news/(my article) instead of index.php/news/(my article). index.php creates the "view article" link. Model: news_model.php Code: <?php Views: index.php, create.php, view.php, success.php index.php Code: <?php foreach ($news as $news_item): ?> create.php Code: <h2>Create a news item</h2> view.php Code: <?php success.php Code: Success! Controller: news.php Code: <?php
[eluser]Ayeyermaw[/eluser]
Can you also show the section of your view that shows the <form> open tag.
[eluser]codelogic[/eluser]
[quote author="Ayeyermaw" date="1337981233"]Can you also show the section of your view that shows the <form> open tag.[/quote] Yeah, it's under create.php in my post ![]()
[eluser]Ayeyermaw[/eluser]
lol sorry - didnt see it. may have had a wee bit too much sun today ![]()
[eluser]codelogic[/eluser]
[quote author="Ayeyermaw" date="1337981527"]lol sorry - didnt see it. may have had a wee bit too much sun today ![]() No worries ![]()
[eluser]Ayeyermaw[/eluser]
I'll have a think but nothing jumps out at me right now. If you haven't already then edit your application/config/config.php and set: Code: $config['log_threshold'] = 4;
[eluser]codelogic[/eluser]
[quote author="Ayeyermaw" date="1337981955"]I'll have a think but nothing jumps out at me right now. If you haven't already then edit your application/config/config.php and set: Code: $config['log_threshold'] = 4; I have changed that to 4, but now when I look at application/logs, all it shows is index.html, with a "Directory access is forbidden" message.
[eluser]InsiteFX[/eluser]
Sounds like your base url or routes are messed up someplace. Show your base url and routes file.
[eluser]Ayeyermaw[/eluser]
oh! Maybe you are overriding the log path? In the same config file check Code: $config['log_path'] = ''; if you still cant see the log files then there's a problem with your codeigniter setup
[eluser]codelogic[/eluser]
[quote author="InsiteFX" date="1337982393"]Sounds like your base url or routes are messed up someplace. Show your base url and routes file. [/quote] Code: $config['base_url'] = 'mysiteurl.com/CI/'; Code: $route['news/create'] = 'news/create'; [quote author="Ayeyermaw" date="1337982477"]oh! Maybe you are overriding the log path? In the same config file check Code: $config['log_path'] = ''; if you still cant see the log files then there's a problem with your codeigniter setup[/quote] I did not override it, I left it blank! And I believe my settup is fine... I don't see what is wrong with my setup. Damn I want this problem to be fixed so I can move along with learning more CodeIgniter. Edit: I fixed the issue by adding http://. I guess it was that simple of a fix ![]() But... I have ran into another minor problem. When I click 'view article' on my index.php/news page... it directs me to index.php/news/news/[article] with a 404. |
Welcome Guest, Not a member yet? Register Sign In |