Custom Module AJAX/Posts are not working
So, I'm creating a module called "Explore Pics"... it's going to be a module to manage pictures on the front page.
It is in a group called "JBProject"...
I've created a "JBPRoject" controller in the fuel/controllers area.. it is the same as tools...
I've created an ExplorePics module.. but when I try to post to explorepics/edit_gallery it get a 404... now.. i've also tried jbproject/explorepics/edit_gallery..
the only thing that I can get to work is jbproject/edit_gallery...
thank you
Comments
More on Advanced Modules here:
http://www.getfuelcms.com/user_guide/modules/advanced
Yes, it's lowercase in the class.
Yes I added a class 'jbproject' to fuel/modules/fuel/controllers ...
I did this to group the 'Advanced Modules' together...
$config['nav']['jbproject'] = array(
'explorepics' => 'Explore Pictures'
);
when it should have been:
$config['nav']['jbproject'] = array(
'jbproject/explorepics' => 'Explore Pictures'
);
All I want is an Advanced Module to work within a group of adv. modules... basically have it nested under a group just like seo is nested under tools..
Something is wrong with my routes.. I get the group to show up on the nav.. The views come up.. Its just that my posts and ajax calls don't work. I get a 404 error.
$route[FUEL_ROUTE.'jbproject/explorepics/(:any)'] = 'explorepics/$1';
the ajax call or post request is in the explorepics.php which extends the Fuel_base_Controller ...
function editgallery()
{
echo "edit gallery";
return;
}
http://localhost/fuel/jbproject/explorepics/editgallery
Is your routes file being loaded (is it named fuel/modules/jbproject/config/jbproject_routes.php)?
jbproject is a controller in fuel/modules/fuel/controllers/jbproject.php
My routes file is located:
fuel/modules/explorepics/config/explorepics_routes.php
$route[FUEL_ROUTE.'jbproject/explorepics'] = 'explorepics/jbproject'; $route[FUEL_ROUTE.'jbproject/explorepics/(:any)'] = 'explorepics/jbproject/$1';
If you have a controller the same name as the advanced module folder, then you can access the controller at just "explorepics".
I would first try and get those pages to show up by accessing them through the non-routed path. After that is done, I'd set up the routes.
#1.. JBProject only purpose is to group the submodules together like "tools" does for seo, page analysis, google keywords.. JBProject needs absolutely no functionality.. I duplicated the tools pattern where I saw "tools.php" in the /fuel/modules/fuel/controller/tools.php.. (This worked, the automatic submodules list were there.. but ajax/posts did not work)
#2.. I'm sooooooo confused about why you would do this:
$route[FUEL_ROUTE.'jbproject/explorepics'] = 'explorepics/jbproject';
as opposed to this
$route[FUEL_ROUTE.'jbproject/explorepics'] = 'jbproject/explorepics';
#3 even if doing so.. how do I get it to automatically list all the submodules like it does when I drop the file in feul's controller folder???
What I want is this to work
/jbproject/explorepics/editgallerymethod
but.. 404..
btw.. JBProject is not the real name. I don't want my real projects name showing up in search engines...
http://brookstowninn.jbwebservices.com/help_brookstown_module.jpg
A simple demo example of an advanced module would make this so easy.. with the grouped sub modules.. and a simple echo response from a post..
everything works but the methods.
http://www.getfuelcms.com/user_guide/modules/advanced
Then within the "fuel/modules/jbproject/controller" folder you'll need to setup a controller of "explorepics". The route would then be the following:
$route[FUEL_ROUTE.'jbproject/explorepics/(:any)'] = 'jbproject/explorepics/$1';
The would allow you to access the "editgallery" method at "fuel/jbproject/explorepics/editgallery" using the route. Without the route, the path should be "jbproject/explorepics/editgallery"
It looks like you may have this setup and it's not working?
In fuel/module/fuel/controller there is 'jbproject.php'... just a generic file that automatically groups the submodules together...
$config['nav']['jbproject'] = array(
'explorepics' => 'Explore Pictures',
'hotelpackages' => 'Hotel Packages',
'hmslider' => 'Home Page Slider'
);
dropped the 'jbproject/explorepics'.. made it just 'explorepics'...
I think the main problem was not doing this correctly
$route[FUEL_ROUTE.'explorepics/(:any)'] = 'explorepics/$1';
Companies need to promote their products/services to get the attention from their potential customers. The digital marketing is the most popular way in the modern age. You can’t use all of the online marketing methods because it is a diverse field and this is why picking up one or two techniques is the most appropriate way. I have been using SMM and Adwords Marketing for my brand and highly satisfied with the results.