Hey guys. I was just learning about super modules and sub-modules but now I am stuck because my run function is somehow not displaying a separate module's view from my welcome module homepage view.
From the documentation it should be a simple in my homepage view file which triggers my Project's show_projects function just fine, I can even see the proper json data on my homepage coming from it if I echo out the json data:
So why would the show_projects.php file not display? I am confused. I can even go to the show_projects url directly and it displays the table and data just perfect so I am stumped. Thanks for any help!
Calling another view module shows blank page
3 years ago
3 years ago
#1
3 years ago
#2
Hello,
What is your Super module name and Sub module name?
If calling from a view file use
What is your Super module name and Sub module name?
If calling from a view file use
3 years ago
#3
Hello,
To follow up on this, I was able to basically get it to work by calling
rather than
in my "Ads" module controller file. So basically I was trying to call a project's function/view from my ad controller file. I guess it is not appropriate to call the template function in this case and it ended up loading the template just fine after changing the code anyways but I think this is all related to some bad navigation setup work that I am trying to work out but I will open another topic for that.
I had got the idea by looking at documentation and videos about calling one module from another so this is actually not a super/sub module setup.
To follow up on this, I was able to basically get it to work by calling
rather than
in my "Ads" module controller file. So basically I was trying to call a project's function/view from my ad controller file. I guess it is not appropriate to call the template function in this case and it ended up loading the template just fine after changing the code anyways but I think this is all related to some bad navigation setup work that I am trying to work out but I will open another topic for that.
I had got the idea by looking at documentation and videos about calling one module from another so this is actually not a super/sub module setup.
3 years ago
#4
It might be the the projects module is getting confused and does not know where to find the view file. So, if I'm right, the cure is to add the following line of code inside your projects controller, before loading the view file:
3 years ago
#5
If there's anything about this that's unclear or if you're continuing to have problems then let me know. I'll be happy to update the docs or create a YouTube video, if there needs to be additional clarification.
3 years ago
#6
H David. Thanks for responding. I believe I had tried that before because I really tried everything and went through all the documentation and videos I could find but the issues may have just been stemming from the problematic way that I had my navigation setup in tabs.
What I am trying to do is have my navigation menus use dynamic links using passed in data. Before I was trying to use posted data in my view files (if else mess) and queries in my controller files but it's just a mess so I am trying to figure out the proper way. I was storing posted data in the $_SESSION array and then calling modules from my view files but that just seems to go against the purpose of the framework and makes the code an ugly mess anyways.
Since I am getting rid of my tabs approach, if possible, for example, I would like to select a project record from one module's view and have my 'public' template file be able to build dynamic menu links using the id of whatever project record was selected. Seems like a simple idea but I am not used to this framework yet so anything you can help me with would be great.
I am thinking I need to grab the posted project ID in my Welcome module after selecting a project record and then pass that project ID into my template file like this: Then build my dynamic link in my public template view file. I am just working on this now as I type so I will post back if I get it to work.
Your youtube videos and documentation have been a big help so anything more you create would only benefit the community I am sure. Especially when it comes to handling and storing posted/session data across a site and then running queries to get further details or building dynamic links in template files. I really love the whole layout of the framework but I just need to learn the ropes of best practices using it. Thanks for any help and cheers!
What I am trying to do is have my navigation menus use dynamic links using passed in data. Before I was trying to use posted data in my view files (if else mess) and queries in my controller files but it's just a mess so I am trying to figure out the proper way. I was storing posted data in the $_SESSION array and then calling modules from my view files but that just seems to go against the purpose of the framework and makes the code an ugly mess anyways.
Since I am getting rid of my tabs approach, if possible, for example, I would like to select a project record from one module's view and have my 'public' template file be able to build dynamic menu links using the id of whatever project record was selected. Seems like a simple idea but I am not used to this framework yet so anything you can help me with would be great.
I am thinking I need to grab the posted project ID in my Welcome module after selecting a project record and then pass that project ID into my template file like this: Then build my dynamic link in my public template view file. I am just working on this now as I type so I will post back if I get it to work.
Your youtube videos and documentation have been a big help so anything more you create would only benefit the community I am sure. Especially when it comes to handling and storing posted/session data across a site and then running queries to get further details or building dynamic links in template files. I really love the whole layout of the framework but I just need to learn the ropes of best practices using it. Thanks for any help and cheers!
3 years ago
#7
do you have only one module, or one module with a submodule within?
if you use sub module inside a super module, remember to let the sub module know the parent to. so in submodule controller, create a constructor and destruct method:
then try from your viewfile:
not sure if i got the question right by just my 2 cents about super/sub modules.
if you use sub module inside a super module, remember to let the sub module know the parent to. so in submodule controller, create a constructor and destruct method:
then try from your viewfile:
not sure if i got the question right by just my 2 cents about super/sub modules.
3 years ago
#8
I ended up doing what I described in my previous post which may or may not be the best approach but it is organized and working for now. I am basically submitting any forms to my welcome module and handling any posted values and logic in my index function. I know this isn't the way it is taught in the documentation and videos but it is working just fine for my needs.