Welcome Guest, Not a member yet? Register   Sign In
How to create a hostel locator solution
#1

Hello everyone,

Please am a newbie and I have spent only two months with codeigniter. I have only created a very basic CMS. I want to design a hostel locator application. I need a guide and ideas to go about it.

There would be definitely admin and users/customers who should register to either advertise their hostel or search for.

I have factored I would be needing about 3-4 database tables. I have identified only three. See them below with their structure

users
        uid     int(11) PRY KEY
        firstname varchar(50)
        lastname varchar(50)
        username varchar(50)
        email     varchar(50)
        pwd     varchar(255)
        status     TINYINT(11)
        reg_date timestamp(CURRENT_TIME)

    hostels
        hid    int(11)
        uid    int(11) referencing (users.uid)
        name    varchar(255)
        desc    text
        state    varchar(50)
        city    varchar(200)
        location varchar(200)
        purpose    varchar(50)
        price   int(11)
        
    orders
        oid     int(11)
        hid    int(11) referencing (hostels.hid)
        uid    int(11) referencing (users.uid)

Please I need further ideas. Thank you.
Reply
#2

No one can design an application for you. Start building and expect that you will need to refactor your code once or twice. :-)
But first advice - if you have users who need to login - don't try to create the login yourself - use a library like ion auth.
Reply
#3

This may help you to find decent libraries (like the google maps API)

https://github.com/codeigniter-id/awesome-codeigniter
Reply
#4

Thanks cartalot for pointing out ion auth, didn't know it existed until you mentioned it.
Thanks acsv for the pointer.

I have a question please. I hosted the cms I created on a remote serve and I'm having error. This code is supposed to dynamically fetch menu items once they're created. Any ideas please?

here is the link royacle.siryoungedu.com


core/ MY_Controller.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Public_Controller extends MY_Controller{
function __construct(){
parent::__construct();

$this->load->library('Menu');
$this->pages = $this->menu->get_pages();

}

libraries/Menu.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Menu{
public function __construct(){
$this->CI =& get_instance();
$this->CI->config->item('base_url');
}

public function get_pages(){
$pages = $this->CI->Page_model->get_menu_pages();
return $pages;
}


}

models/Page_model.php

public function get_menu_pages(){
$this->db->select('*');
$this->db->from($this->table);
$this->db->where('in_menu', 1);
$this->db->where('is_published', 1);
$this->db->order_by('order', 'asc');


$query = $this->db->get();

if ($query->num_rows() >= 1) {
return $query->result();
}
else {
return FALSE;
}

}

view file

<ul class="nav navbar-nav navbar-right">
<li><a href="<?php echo base_url(); ?>">Home</a></li>

<?php if ($this->pages) : ?>
<?php foreach($this->pages as $page) : ?> //line 23 public.php
<li><a href="<?php echo base_url(); ?>pages/show/<?php echo $page->slug; ?>"><?php echo $page->title; ?></a></li>
<?php endforeach; ?>
<?php else : ?>

<?php endif; ?>

</ul>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB