Part of the EllisLab Network
   
2 of 24
2
Modular Separation (deprecated by Matchbox)
Posted: 13 November 2006 11:24 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  09-24-2006

Hi again. Yeah my application folder config setting is set correctly in the index.php file and have the Base4.php as above. Still issues :(...Anyway. i’ve gone for a more low-fi version of want to do for now and i’ll come back to this when i’ve got some time on my hands. Cheers dyna

Profile
 
 
Posted: 11 December 2006 07:07 PM   [ Ignore ]   [ # 12 ]  
Summer Student
Total Posts:  23
Joined  04-15-2006

Great work dynazack!

We can make our web applications more organized this way - into logical parts for each web module.
I tried it and it works fine on my CI setup - using PHP5 of course.

But how do you call a ‘global’ view that is not in the current module’s view folder. I may want to apply a generic / same view (such as a header or footer) to construct a page even though different modules are used.

To explain further, view files are stored in a ‘views’ folder under modules/MODULENAME folder

/system/application/modules/MODULENAME/views/

But how do I use a view file from the following folder?

/system/application/views

Profile
 
 
Posted: 12 December 2006 03:58 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  486
Joined  09-14-2006

First of all, kudos dynazack.

Ericos - 11 December 2006 07:07 PM

But how do I use a view file from the following folder?

/system/application/views

To use the default views directory, you simply load the view as normal. If you look at dynazack’s code, the $view is only loaded from the module’s views directory if it exists there, otherwise it falls back to default views folder. So unless you also have a header or footer in the module’s views directory there should be no conflict.

 Signature 

Code Igniter 1.5.4 / CentOS 5 / PHP 5.2.3 / Apache 2.2.2 / MySQL 5.0.27

Profile
 
 
Posted: 12 December 2006 11:36 PM   [ Ignore ]   [ # 14 ]  
Summer Student
Total Posts:  23
Joined  04-15-2006

Thank joeles… grin

Your comments are very helpful. Should have studied the code more carefully.

I think this should be a core feature for CI since application can really get out of hand and we do need a way to organize our codes.

Profile
 
 
Posted: 13 December 2006 05:11 PM   [ Ignore ]   [ # 15 ]  
Grad Student
Avatar
Rank
Total Posts:  37
Joined  09-12-2006

I am trying the module concept and have applied your classes, but I am getting “Headers already sent by MY_Router.php” errors when trying to use with other classes such as Native_session or the URL Helper, etc.

I am assuming this is due to the order of how the classes are loaded. Sill looking into it, but thought I would post this in case someone has any tips.

Cheers.

 Signature 

—Local Dev Environment——————————
 

  CodeIgniter 1.5.1
 

  XAMMP 1.5.5
  Apache 2.2.0 (Win32)
  PHP Version 4.4.4 up to 5+
  MySQL 3.23.58 up to 5.0.27
  Windows XP Pro
 

  Eclipse w/ PHPEclipse & Aptana (coding)
  Dreamweaver (design)

—————————————————————————-

Profile
 
 
Posted: 13 December 2006 05:31 PM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  486
Joined  09-14-2006
slillig - 13 December 2006 05:11 PM

I am trying the module concept and have applied your classes, but I am getting “Headers already sent by MY_Router.php” errors when trying to use with other classes such as Native_session or the URL Helper, etc.

I am assuming this is due to the order of how the classes are loaded. Sill looking into it, but thought I would post this in case someone has any tips.

Cheers.

That error is caused by something being output to the browser before the headers are sent. It’s sometimes caused by another error being sent, but if you don’t see another error on the page, it’s more than likely caused by extra white space before PHP open tag or after your close tag.

 Signature 

Code Igniter 1.5.4 / CentOS 5 / PHP 5.2.3 / Apache 2.2.2 / MySQL 5.0.27

Profile
 
 
Posted: 13 December 2006 06:13 PM   [ Ignore ]   [ # 17 ]  
Research Assistant
RankRankRank
Total Posts:  404
Joined  02-14-2007

Have you checked for any whitespace before or after the <?php or ?> marks?  That is a common culprit.

edit: Joeles beat me to it.  Whoops!

Profile
 
 
Posted: 13 December 2006 07:03 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  37
Joined  09-12-2006

I think that was it… thanks for the quick response.

I am trying to integrate Peccavi’s UserAuth as a module, so I am onto debugging other problems at the moment. Will post more if I get it running correctly.

 Signature 

—Local Dev Environment——————————
 

  CodeIgniter 1.5.1
 

  XAMMP 1.5.5
  Apache 2.2.0 (Win32)
  PHP Version 4.4.4 up to 5+
  MySQL 3.23.58 up to 5.0.27
  Windows XP Pro
 

  Eclipse w/ PHPEclipse & Aptana (coding)
  Dreamweaver (design)

—————————————————————————-

Profile
 
 
Posted: 23 December 2006 04:58 AM   [ Ignore ]   [ # 19 ]  
Summer Student
Total Posts:  23
Joined  04-15-2006

i was trying this modularity capability againg in my CI apps

dynazack, can the controllers placed in the original controllers folder be still used?

Profile
 
 
Posted: 23 December 2006 05:42 AM   [ Ignore ]   [ # 20 ]  
Summer Student
Total Posts:  23
Joined  04-15-2006

i managed to solve it! grin

dynazack’s MY_Router class replaces CI_Router’s original function _validate_segments(). However, CI_Router’s _validate_segments() returns the $segments variable that was passed to it as a parameter but MY_Router’s _validate_segments() doesn’t.

So the fix is a simple one. Just add the keyword “return” to the last line of code, as follows:

function _validate_segments($segments) {

    
...

    
//originally it was just "parent :: _validate_segments($segments);"
    
return parent :: _validate_segments($segments);

}

Now you can have modularity when you require it but also when you don’t.

Profile
 
 
   
2 of 24
2
 
     YATS -- The Layout Library ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66428 Total Logged-in Users: 38
Total Topics: 84791 Total Anonymous Users: 3
Total Replies: 455014 Total Guests: 231
Total Posts: 539805    
Members ( View Memberlist )
Newest Members:  X_franllogocsaturkeyPeter BryanttherendStudioGeorgiaJZeerfedegheEdgedcentice