Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8309891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:15:46+00:00 2026-06-08T19:15:46+00:00

I want a webpage , which main content is used by ajax view. and

  • 0

I want a webpage , which main content is used by ajax view. and a menu sidebar.

my application views folder is

+pages
  -home
templates
  -header
  -footer

My main pages controller is :

<?php 

class Pages extends CI_Controller {

        public function view($page = 'home')
        {
            $this->load->model('services_model');
            $data['records']= $this->services_model->getAll();
            if ( ! file_exists('application/views/pages/'.$page.'.php'))
            {
                // Whoops, we don't have a page for that!
                show_404();
            }

            $data['title'] = ucfirst($page); // Capitalize the first letter

            $this->load->view('templates/header', $data);
            $this->load->view('pages/'.$page, $data);
            $this->load->view('templates/footer', $data);

        }

}

My service_model is:

<?php
class Services_model extends CI_Model {

    function getAll() {
        $q = $this->db->get('services');
        if($q->num_rows() > 0){
        foreach ($q->result() as $row)
        {
            $data[] = $row;

            }
        return $data;
    }
    }
}

And my view is :

<ul class="blog-medium">
 <?php foreach($records as $row);?>
    <li>
    <div class="blog-medium-text">      
    <h1><a href="./post.html"><?php echo $row->title; ?></a></h1>
    <p class="blog-medium-excerpt">
    <?php echo $row->content; ?> <br />
    <a href="./post.html" class="read_more">Devamı &rarr;</a></p>
    </div>
    <div class="blog-medium-text"><p class="blog-info">
    <img src="./images/icon-time.png" alt="" />March 14, 2012 
    <img src="./images/sep.gif" alt="" /><img src="./images/icon-comment.png" alt="" />0 Yorum</p>
    </div></li>
    <?php endforeach;?>

so my problem is in implementing service_model in the code., there is no problem . Can you show me a way to work correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:15:49+00:00Added an answer on June 8, 2026 at 7:15 pm

    Just use one dedicated controller(ajax) for all your ajax calls..

    A common controller

    class Ajax_Controller extends CI_Controller {
      public function index(){
        // Add the logic which you want to share among all ajax calls
        // like doing security check and all
      }
    }
    

    extend the common controller to handle specific request

    class <SomeName>Ajax_Controller extends Ajax_Controller {
      public function <some_action>(){
        // write the request specific logic here.
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UserControl which I want to have 3 possible states: -Main menu
I want to fetch the title of a webpage which I open using urllib2.
I'm creating a webpage which has several fields. I do not want the php
i want to convert my webpage(displayed in UIWebView) contents in pdf file. which can
what I want: Download a webpage from a server > Save content in a
I'm keeping the main content area of the webpage small, so that footer navigation
I have a tableview inside a popover in my main view which is a
I want to build a webpage which has 3 tabs (and thus 3 divs):
I have a button on my webpage which when onClick I want it to
There are few webpage which employs some javascript/ajax calls to fill some fields in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.