Welcome Guest, Not a member yet? Register   Sign In
Create new page?
#1

[eluser]eperez[/eluser]
A friend create a website for some software I made, towards the beginning of the year. Since I'm not a web developer, I'm having a hard time figuring everything out.

I'm trying to create a new web page. And in doing so, I just copy the code I've seen everywhere else through out the site, but with the new page's name. But that didn't work.

If I wanted to create a link to the "download.php" page, all I'd have to do is create an anchor with that name, but without ".php."

Code:
a href="download"Download

And if I wanted to link to my FAQ page, I'd do the same, but also put "info" in there since it's within the "info" folder on my server:

Code:
a href="info/faq"FAQ

So, copied one of the pages, renamed it to "albums.php" and put it in the "info" folder. I then created an anchor for it:

Code:
a href="info/albums"Photo Albums

But all I get is a 404 when I click the link. So, I thought there was maybe another file somewhere on the server that handled the URIs like this. I've been through a couple that appeared to be what I was looking for, like "routes.php" and "url_helper.php." But after looking through these files, I didn't see any thing that the original guy would have coded, in order to link URIs together.

Anyone have any ideas?
#2

[eluser]theprodigy[/eluser]
Make sure your 'albums.php' file contains at a minimum code that looks like:
Code:
<?php
class albums extends CI_Controller //Check the other files to see what they are extending, and extend the same thing (like MY_Controller or something)
{
    public function __construct()
    {
        parent::__construct();
    }
    public function index()
    {
        //This is for 'info/albums'. It gets called when nothing comes after 'albums'
    }
}
?>
#3

[eluser]eperez[/eluser]
[quote author="theprodigy" date="1306116334"]Make sure your 'albums.php' file contains at a minimum code that looks like:
Code:
<?php
class albums extends CI_Controller //Check the other files to see what they are extending, and extend the same thing (like MY_Controller or something)
{
    public function __construct()
    {
        parent::__construct();
    }
    public function index()
    {
        //This is for 'info/albums'. It gets called when nothing comes after 'albums'
    }
}
?>
[/quote]

theprodigy,

Thanks for the information. I'll try that, but none of my other pages are extending any controllers.

You can take a look at the source of of pages here: http://avertsoftware.com/download
#4

[eluser]theprodigy[/eluser]
I can't view server side code through the browser.
#5

[eluser]eperez[/eluser]
[quote author="theprodigy" date="1306118188"]I can't view server side code through the browser.[/quote]

I was just referring to the HTML code. If there's a particular document you need to see, I can upload it.

I'm looking through all of the pages in the "controllers" folder and found the "info.php." Within the main folder, this file is just a normal webpage, but within this one, it contains the following code:
Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Info extends Controller {

    function Info()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('info');
    }
    function faq()
    {
    $this->load->view('info/faq');
    }
    function history()
    {
    $this->load->view('info/history');
    }
}

This looks like what I'm looking for. I'm going to play around with it to see what I get.
#6

[eluser]eperez[/eluser]
Eureka! That's what did it.

I bypassed up files in the folder before, because they were named the same as the normal webpage files. But, after you mentioned "controllers", I took another look and it works great. Well, mostly great. For some reason, none of the pages within the "info" directory load CSS or Javascript.

In order to get the page to work, I just added a new method similar to the others:

Code:
function albums()
    {
        $this->load->view('info/albums');
    }




Theme © iAndrew 2016 - Forum software by © MyBB