[SOLVED]How do I set the page template for my module and other dumb questions...

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

[SOLVED]How do I set the page template for my module and other dumb questions...

Post 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
Last edited by kittymcooper on Sun Jan 17, 2010 2:53 am, edited 1 time in total.
Kitty Munson Cooper, web designer, programmer
Salketer

Re: How do I set the page template for my module and other dumb questions...

Post 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 ;D

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.
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

Re: How do I set the page template for my module and other dumb questions...

Post 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
Kitty Munson Cooper, web designer, programmer
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: How do I set the page template for my module and other dumb questions...

Post 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.
Last edited by Wishbone on Sat Jan 16, 2010 7:54 pm, edited 1 time in total.
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

Re: How do I set the page template for my module and other dumb questions...

Post 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.
Kitty Munson Cooper, web designer, programmer
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

[SOLVED] Re: How do I set the page template for my module

Post by kittymcooper »

Thanks wishbone!  the returnid was the key to getting the template I wanted!! Now it uses the template of the returnid page
Kitty Munson Cooper, web designer, programmer
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

Re: How do I set the page template for my module and other dumb questions...

Post 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
Kitty Munson Cooper, web designer, programmer
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: How do I set the page template for my module and other dumb questions...

Post 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.
Post Reply

Return to “Developers Discussion”