CodeIgniter Forums
convert to CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: convert to CI (/showthread.php?tid=65184)

Pages: 1 2


RE: convert to CI - PaulD - 05-13-2016

Read the documentation - Please

http://www.codeigniter.com/user_guide/tutorial/static_pages.html#static-pages


RE: convert to CI - davy_yg - 05-13-2016

I have read the documentation and still do not understand which to change.  I try this:


controllers/Welcome.php



PHP Code:
public function index()
    {
                
        $this
->load->view('index');
        
    
}
    
    public 
function view($page 'pages')
    {
                
        $this
->load->view('pages');
        
    

and still shown:
404 Page Not Found
The page you requested was not found.
If you click the navigation bar.


RE: convert to CI - PaulD - 05-13-2016

Assuming you are trying to fix this link

PHP Code:
<?php echo site_url('pages'); ?>

The link to the docs I posted for you, explains

Code:
For example, when a call is made to:

http://example.com/news/latest/10
We might imagine that there is a controller named “news”. The method being called on news would be “latest”. The news method’s job could be to grab 10 news items, and render them on the page. Very often in MVC, you’ll see URL patterns that match:

http://example.com/[controller-class]/[controller-method]/[arguments]

Your controller is 'Welcome', your method is 'pages', so your link is

PHP Code:
<?php echo site_url('welcome/pages'); ?>

However, if that is your entire Welcome.php you need to declare the class as the same as the filename, so in you case it would be something like

PHP Code:
<?php
class Welcome extends CI_Controller {

 
       public function pages()
 
       {
 
       }


This is all clearly and thoroughly explained in the documentation.

Hope that helps,

Paul.


RE: convert to CI - davy_yg - 05-13-2016

Thanks for help.  After revising the codes, if I click the navigation link:

http://127.0.0.1/backend_CI/index.php/cpages/contents.php

Instead of
http://127.0.0.1/backend_CI/index.php/cpages/contents

I wonder why?




navigation.php


PHP Code:
<li class="active"><a href="index.php"><class="icon icon-home"></i> <span>Administrator</span></a></li>
            <
li class="submenu">
                <
a href="#"><class="icon icon-th-list"></i> <span>Categories</span> <span class="label">2</span></a>
                <
ul>
                    <
li><a href="pcategories.php">Parent categories</a></li>
                    <
li><a href="scategories.php">Sub Categories</a></li>
                </
ul>
            </
li>
            <
li><a href="<?php echo site_url('cpages/pages'); ?>"><class="icon icon-tint"></i> <span>Pages</span></a></li>
            <
li><a href="<?php echo site_url('cpages/slideshows'); ?>"><class="icon icon-pencil"></i> <span>Slideshow</span></a></li>
            <
li><a href="<?php echo site_url('cpages/contents'); ?>"><class="icon icon-th"></i> <span>Content</span></a></li>
            <
li><a href="<?php echo site_url('cpages/galleries'); ?>"><class="icon icon-th-list"></i> <span>Galleries</span></a></li>
            <
li><a href="<?php echo site_url('cpages/newsletters'); ?>"><class="icon icon-th-list"></i><span>Newsletters</span></a></li


controllers/cpages.php

PHP Code:
public function pages() {  $this->load->view('pages');  }
    
    public function 
slideshows() {  $this->load->view('slideshows');  }

    public function 
contents() {  $this->load->view('contents');  }
    
    public function 
galleries() {  $this->load->view('galleries');  }

    public function 
newsletters() {  $this->load->view('newsletters');  }
    
    public function 
settings() {  $this->load->view('settings');  



RE: convert to CI - davy_yg - 06-08-2016

How to fix this error?


I attached the database in the attachment (giondacms).



Code:
[b]Fatal error[/b]: Call to undefined method Cpages::_example_output() in [b]C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\cpages.php[/b] on line [b]101[/b]
A PHP Error was encountered
Severity: Error
Message: Call to undefined method Cpages::_example_output()
Filename: controllers/cpages.php
Line Number: 101
Backtrace:

controllers/cpages.php



PHP Code:
    public function slideshows() {  $this->load->view('slideshows');  }
    
    public 
function slideshowimages() 
    
        
 
    
        $image_crud 
= new image_CRUD();
    
        $image_crud
->set_primary_key_field('id');
        $image_crud->set_url_field('url');
        $image_crud->set_title_field('title');
        $image_crud->set_table('example_4')
        ->set_ordering_field('priority')
        ->set_image_path('assets/uploads');
            
        $output 
$image_crud->render();
    
        $this
->_example_output($output);
    
        $this
->load->view('slideshow_images'); 
    
        
}

    public function contents() {  $this->load->view('contents');  


views/slideshow_Images.php

PHP Code:
<div class="row-fluid">
                <
div class="span12">
                    
                    
                    
Slideshow Name  <input type="text"></input>
        
                    <
button type="button" class="add" href="adminform.php">ADD SLIDESHOW</button
                    
                    
                    <
div>
                    
                    <?
php /* <a href='<?php echo site_url('images_examples/example1')?>'>Example 1 - Simple</a> |
                    <a href='<?php echo site_url('images_examples/example2')?>'>Example 2 - Ordering</a> |
                    <a href='<?php echo site_url('images_examples/example3/22')?>'>Example 3 - With group id</a> | */ 
?>
                    <a href='<?php echo site_url('cpages/slideshowimages')?>'>Example 4 - Images with title</a> | 
                    <?php /* <a href='<?php echo site_url('images_examples/simple_photo_gallery')?>'>Simple Photo Gallery</a> */ ?>
                    
                    </div>
                    
                    <div style='height:20px;'></div>  
                    <div>
                    <?php echo $output?>
                    </div>
                                        
                    <div class="widget-box">
                        <div class="widget-title"><h5>Slideshows</h5></div>
                        <div class="widget-content">
                        
                            
                        </div>
                    </div>                    
                </div>
            </div>