CodeIgniter Forums
Create pages .php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Create pages .php (/showthread.php?tid=40678)



Create pages .php - El Forum - 04-15-2011

[eluser]Stoppy[/eluser]
Hi!
I am rewriting an old website. This website has a series of .php pages. These pages are well positioned in google and we would like to maintain this pages. So i would like to know if is possible (and how) to use codeigniter models and views to develop them.


Thank you
Peppe


Create pages .php - El Forum - 04-15-2011

[eluser]bubbafoley[/eluser]
you can set the url_suffix config item to append .php to your urls.

http://ellislab.com/codeigniter/user-guide/general/urls.html

see the section 'Adding a URL Suffix'


Create pages .php - El Forum - 04-15-2011

[eluser]Stoppy[/eluser]
[quote author="bubbafoley" date="1302910590"]you can set the url_suffix config item to append .php to your urls.

http://ellislab.com/codeigniter/user-guide/general/urls.html

see the section 'Adding a URL Suffix'[/quote]

Hi,
maybe I was not so clear.
Condeigniter works MVC model-controller-view

From a controller I call one or more modules then a view and send the output.

I would like to create pages (true files) .php in the server, use them as "controllers" and use there models and views i have in my application/ directory


for example i have

/application
/application/models/mypersonal_model.php
/appucation/views/mypersonal_view.php
/controllers/
/system
index.php

anotherpage.php
anotherdirectory/anotherpagetwo.php


in anotherpage.php i would like to write or use a controller....
Is crazy I know but there is a way?

The first solution i had was to create a standard MVC and inside the page call it using file_get_contents() ... but is an horrible solution!

there is or not a way? what do you think?

Thank you


Create pages .php - El Forum - 04-15-2011

[eluser]bubbafoley[/eluser]
Quote:Condeigniter works MVC model-controller-view

From a controller I call one or more modules then a view and send the output.

I would like to create pages (true files) .php in the server, use them as “controllers” and use there models and views i have in my application/ directory

Your controllers have to go in application/controllers. That's where CI looks for them.

But it can be done with routes. You still have to save your controllers in the controllers directory but you can reroute anotherpage.php to run a controller.

Code:
$route['anotherpage.php'] = 'controller/method';



Create pages .php - El Forum - 04-15-2011

[eluser]Stoppy[/eluser]
Perfect!
The route is the solution i think!
Thank you!