-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to access others CI's Controllers (not Welcome)? #3
Comments
Alright, this depends on some careful cooperation of the WordPressIgniter settings and CodeIgniter's config/routes.php settings. Since both WordPress and CodeIgniter each have their own 404 handling methods, they both need some attention. In the plugin settings, there are two checkboxes: "Divert 404s to WordPressIgniter" and "CodeIgniter grabs all SEO urls (use with caution!!)". "Divert 404s to WordPressIgniter" UNCHECKED: "Divert 404s to WordPressIgniter" CHECKED: "CodeIgniter grabs all SEO urls" UNCHECKED: "CodeIgniter grabs all SEO urls" CHECKED: Sorry if I'm not good at explaining, some of this you're probably going to need to experiment with yourself, but trust me I've spent many long hours with lots of different methods to arrive at what we have now. Probably the bottom line understanding is that when the plugin is enabled, CodeIgniter ALWAYS runs. Depending on those two settings described above, and the configuration in config/routes.php, CodeIgniter WILL do one of these 4 things:
Again, with this plugin enabled, CodeIgniter WILL do one of the 4 things above, even if its output isn't rendered out to the user. This theoretically can result in some special circumstances. Say you have a path collision, perchance that you have a CodeIgniter controller and method (or custom route) that responds to /categories/uncategorized . The specific CI controller and method will run, even though WordPress renders out its own category view. This is for two reasons: 1. It wasn't a WordPress 404 and 2. It wasn't a CodeIgniter 404. So just be careful to avoid this kind of CodeIgniter routing collisions (unless you really intended it). |
Hey Dan thanks for the explanation, and for the good job. I will expriment those options carefully later. cheers |
Dear Dan, I created the controll sum.php that has the function my_sum($a,$b) I wanted to try to call a controller with parameters . I got the result that is shown in the image It shows that it throws an < h1 > tag with the word wordpressigniter in it But thank you for the nice plug-in |
Thanks for this great plugin, just working my way through the code.
|
Dear Dan, Great job! could you please help us to understand what do you mean when you say "have a sort of a "do nothing" 404 override". Thank you very much. |
How did you manage to use wordpress functions in CI, i tired calling them directly , they do not generate an error but i have no output. Any help on this would be highly appreciated. thx |
It could be a problem with output buffering. I tend to use logging to tackle this kind of problem. Can you write something to a log to see what the functions are doing, i.e. by assigning their return value to a $variable and then echoing it to a log? I know your hosting may not give you very ready access to the logs but I depend heavily on logging in most aspects of my work. :) |
Think of CodeIgniter always running even if it's not a match for the currently loading page in WordPress. It will throw its own internal 404 error on every page that doesn't match a CodeIgniter route. You just won't see anything on pages that WordPressIgniter doesn't catch as a CI-integrated page. I'm more comfortable knowing exactly where CodeIgniter's execution path will go in those situations so I like to use a "catch all, do nothing 404 page". |
You are probably echoing the function's output. Try assigning the function's return value to the $CI_OUTPUT global variable. (Remember to say |
Hi Dan,
how to navigate through the pages of a CI system?
I mean, how to control if its a WP URL or a CI URL?
thanks again
The text was updated successfully, but these errors were encountered: