Page 1 of 1
[SOLVED]How do I set the page template for my module and other dumb questions...
Posted: Sat Jan 16, 2010 6:08 am
by kittymcooper
I have written a module to find my catalog items that begin with a specific letter and it actually is working!! BUT I have a few stupid questions ...
1) how can I tell it which page template to use?
2) what is the cntnt01 in the URL?
I have an A to Z clickable bar which uses the mact form of URL and when clicked a sample URL is
index.php?mact=AZlister,cntnt01,dolist,0&cntnt01category=2595&cntnt01sortletter=M
which sends the parameters category and sortletter to my AZlister module action.dolist.php
that all works fine, but it is not using the default page template which I wish to use so how to set that?
Also a suggestion for the documentation, do refer people to the module install so they know how to install their module (took me way too long to figure that out) and maybe explain the mact form of url?
Kitty
http://openskywebdesign.com
Re: How do I set the page template for my module and other dumb questions...
Posted: Sat Jan 16, 2010 9:25 am
by Salketer
I am still a newbie in module creation but I will give it a try and if it works then it'll be all good for both of us
If the module is called from a specific page, there is good chances according to my understanding that it will use the template specified to it when the module links are specified to apply inline.
about the cntnt01, to my understanding it states where the module action's output will be displayed. cntnt01 always refered to my {content} so far, don't know if it always does though.
Re: How do I set the page template for my module and other dumb questions...
Posted: Sat Jan 16, 2010 5:39 pm
by kittymcooper
Thanks on the cntnt01 explanantion!
By the way I tried cntnt32 instead of cntnt01 hoping for template 32 but no luck and that works just as well
My module is called via a url, not set within a page as in {module ....} so the question I have is how does it determine what page template to use as it does not seem to use my default template?
typical URL used to call my module:
index.php?mact=AZlister,cntnt01,dolist,0&cntnt01category=2595&cntnt01sortletter=M
Re: How do I set the page template for my module and other dumb questions...
Posted: Sat Jan 16, 2010 7:12 pm
by Wishbone
I did a test with a news article to see how it determines the template.. I duplicated my template, and my news page, and set the new news page to the duplicate template... I clicked on the same news article on both pages.. They are in different templates... The only difference in the URL was the "returnid".
Either modules automatically get the template from the returnid, or the News module sets the template using the returnid.
How did you generate the fancy URL, since you're not using it on a page? I've never accessed modules directly before.
Re: How do I set the page template for my module and other dumb questions...
Posted: Sat Jan 16, 2010 11:54 pm
by kittymcooper
Thanks I will try using the returnid and see if it helps
To figure out how to call my module by URL, I looked at the search module and the albums module both of which call new pages via a URL and figured out what the URL should look like based on their URLs. Since I have a bar with the letters from A to Z in my template, each letter is linked to my module using the URL in the style I showed in my post, with the sortletter being a different letter each time.
[SOLVED] Re: How do I set the page template for my module
Posted: Sun Jan 17, 2010 12:21 am
by kittymcooper
Thanks wishbone! the returnid was the key to getting the template I wanted!! Now it uses the template of the returnid page
Re: How do I set the page template for my module and other dumb questions...
Posted: Sun Jan 17, 2010 12:43 am
by kittymcooper
So to be clearer about the URL to call a module, wishbone, the structure is
index.php?mact=MODULE,cntnt01,ACTION,NUM&cntnt01PARAM1=VALUE1&cntnt01returnid=ID
where
MODULE is the name of your module
ACTION is the action, so there is a php file in your module folder called action.ACTION.php
NUM is either 0 or 1 (I used 0), no idea what this is
PARAM1,VALUE1 as many parameters and values as you need to pass into your action script
ID the content_id of a page with the template you want to use
thus
index.php?mact=AZlister,cntnt01,dolist,0&cntnt01category=2595&cntnt01sortletter=M
Re: How do I set the page template for my module and other dumb questions...
Posted: Sun Jan 17, 2010 2:47 am
by Wishbone
I'm glad I could help! I really was just thinking out loud.. Remember to put [Solved] in the subject of this thread.