Welcome Guest, Not a member yet? Register   Sign In
404 page not found...
#1

[eluser]Ivar89[/eluser]
I have 4 pages/links that are bassicly the same and three of them work but with one I get 404 error
Portfolio page doesn't work.

Part Controller:
Code:
<?php

class portfolio extends Controller {

    function portfolio()
    {
        parent::Controller();    
        $this->load->model('port_insert_model');
        
        if(!$this->user_model->Secure(array('userType' => 'admin')))
        {
            $this->session->set_flashdata('flashError', 'This is not a admin account');
            redirect('admin/login');
        }
    }
    function index()
    {
        $data['port'] = $this->port_insert_model->Get_Portfolio_Data($_POST);
        $this->load->view('portfolio/index', $data, FALSE);
    }
    function step1()
    {
    $this->load->view('portfolio/step1');
    }
view:
Code:
view('template/header') ?>
<?php $this->load->view('template/menu'); ?>
                    <div id="main2">
                        <fieldset>
                            <table>
                                <tr style="background-color: lightgrey;"> <td>Description</td> <td>Link</td></tr>
                                <tr> <td>Edit Your Menu items:</td> <td><a  href="&lt;?php echo site_url('menu'); ?&gt;">Menu<a/></td></tr>
                                <tr> <td>Edit Your Page items:</td> <td><a  href="&lt;?php echo site_url('page'); ?&gt;">Page<a/></td></tr>
                                <tr> <td>Edit Your News items:</td> <td><a  href="&lt;?php echo site_url('news'); ?&gt;">News<a/></td></tr>
                                <tr> <td>Edit Your Portfolio items:</td> <td><a  href="&lt;?php echo site_url('portfolio'); ?&gt;">portfolio<a/></td></tr>
                            </table>
                        </fieldset>
                    </div>
    &lt;?php $this->load->view('template/footer'); ?&gt;>
Now the first three work!
I don't know where it goes wrong...:S
menu view:
Code:
<div id="menu">
<img src="/public/img/cms-design_02.gif" ></img>
<label class="button">&lt;?php echo anchor('start/index', 'Home');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('start/content', 'Edit Content');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('start/create', 'Create');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('users/index', 'Users');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('page/upload_form', 'Upload img');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('admin/logout', 'Logout');?&gt;</label>
<img src="/public/img/cms-design_02_nieuw.gif">
<label class="button">&lt;?php echo anchor('page/step1', 'Pagina');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('portfolio/step1', 'portfolio');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('news/step1', 'Publicaties');?&gt;</label><br />
<label class="button">&lt;?php echo anchor('menu/create', 'Menu');?&gt;</label><br />
Again the portfolio one doesn't work...
(I know Its probably better to use anchor instead of href, but thats not the problem now.
#2

[eluser]Ivar89[/eluser]
When I go to portfolio/index it simply goes to th folder portfolio and shows me a system folder:S... while there are actually several .php files in there:S

problems probably not in the code. but something somewhere has probably reserved the name portfolio:S
#3

[eluser]Aken[/eluser]
First, controller names needed to be capitalized. class Portfolio extends CI_Controller

Second, what is your file structure like? Is the Portfolio controller in the root "controllers" folder, or is it in a subfolder? If you are in a subfolder, you need to specify a default controller for that directory if you want it to be accessible. You do this in Routes.
Code:
$route['portfolio'] = 'portfolio/portfolio';
#4

[eluser]John_Betong_002[/eluser]
Try replacing this code:

Code:
// Old code
// function portfolio()
// {
//   parent::Controller();    

// New code
  public function __construct()
  {
    parent::__construct();

// Old stuff goes here

}//endof __construct()
&nbsp;
&nbsp;
#5

[eluser]Ivar89[/eluser]
I only use subfolders in Views
Model and controller are all in root model and controller folders.


The new code
Code:
public function __construct()
  {
    parent::__construct();
makes no difference neither
#6

[eluser]John_Betong_002[/eluser]
Did you manage to solve your problem?

What CI version are you using? If the version is 2.0 or later then as mentioned before, you need to extend CI_Controller and not Controller.
&nbsp;
&nbsp;
#7

[eluser]Ivar89[/eluser]
I managed to solve it by using a different computer, haha
On my own laptop it will still give the error so....I don't know whats wrong really but its not the code I guess...
I use v1.7.2 it is pretty old I know, But I started with this and never updated(don't know how yet haha)

Bu tI think it is not the codeSmile
#8

[eluser]Pedro Luz[/eluser]
updating to a recent version of CI only takes a little more than 10 minutes
#9

[eluser]Ivar89[/eluser]
Yhea I really should, but if I do that I have to edit allot, I mean every controller need to be edited to ci_controller and probably some other stuff from which I do not know, so it iwll take a while and I am SWAMPED atm

But the rpoblem is my laptop because on my work laptop it works flawleslySmile
#10

[eluser]LuckyFella73[/eluser]
Do you have a folder calles "portfolio" in your root/htdocs?
If thats the case you will have to change either the folder-name or controller-name ...

Afaik you can't have a controller and a folder in your htdocs with the
same name (at least if you are using mod-rewrite).




Theme © iAndrew 2016 - Forum software by © MyBB