Creating a user defined tag related to a module.

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
Salketer

Creating a user defined tag related to a module.

Post by Salketer »

Hi everyone,

I would like to define a tag to be able to create a link pointing to the specified page (using alias) and in that same tag I would need to retrieve some database information from a module I have created.

To put it more clearly, the access to the module's items is necessary so I can retrieve the correct id using the name of an item. The link created will not have to hold any information about the module itself, the module information will merely be used to display the appropriate text and to point at the correct anchor within the given page. I can figure out how the management of the link creation but I don't know how to grab an instance of the module to accomplish my needs.

I am not sure if I am clear enough, feel free to request more information as long as you specify what you'd like to know accurately.

Thank you very much for your time!
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

Re: Creating a user defined tag related to a module.

Post by kittymcooper »

Why not make one of the actions in your module the creation of this link? Then call your module with the parameters for the link.
Kitty Munson Cooper, web designer, programmer
Salketer

Re: Creating a user defined tag related to a module.

Post by Salketer »

You are right, that part seemed so complex yet it is very simple... Something like {cms_module module="mymodule" page="thepage" item="itemalias"} would be pretty much all I need. Thanks

Now for the next part, how can I make my module create a valid link to the page requested by the param? Remember I want to pass the alias only.

thank you all!
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am
Location: Fort Collins, CO

Re: Creating a user defined tag related to a module.

Post by kittymcooper »

If you have the content alias then the url
index.php?page=content_alias
(replace content_alias with actual one)
works fine, so maybe I misunderstand your question?

if all you have is the content id then ...
from the doc
http://wiki.cmsmadesimple.org/index.php/User_Handbook/Developers_Guide/Creating_Modules#Access_current_page_id_or_alias
   $hm =& $gCms->GetHierarchyManager();
    $curnode =& $hm->getNodeById($pageid);
    $curcontent =& $curnode->GetContent();
    echo $curcontent->GetURL();
Kitty Munson Cooper, web designer, programmer
Post Reply

Return to “Developers Discussion”