views:

1054

answers:

3

I'm a Joomla developer and I'am trying to build a component(in J!1.5) that uses urlparam for creating custom menu links in the admin.

I want my component to work like the built-in polls component that allows users to select the id of an item in my component.

I tried the xml file for the component but that doesn't work. But I know it's possible, Community Builder is able to use it.

Since the Joomla documentation is lacking when it comes to this feature. Can someone be so kind to give me some insight into how to use implement this in my own components?

EDIT: To clarify: I want to know how to create an input in com_menus with the name "urlparam". From my knowledge JParameter(the components xml file) can't do this.

EDIT2: I'll keep the above for histical purposes but to farther clarify I would like a way to link to an internal page of a custom component from a menu without having to use a external url.

Thanks.

+1  A: 

"urlparam" Do you mean the parameters passed in the URL or is that a specific function name?

The way to retrieve HTTP url encoded parameters in Joomla is to use the class Request.

eg:

JRequest::getVar('name', 'default value');

That retrieves the parameter $_REQUEST['name'] or the 'default value' if it does not exist or evaluates to FALSE.

There are a number of helpful methods of Request that passes the value through filters for you, like JRequest::getCmd(), JRequest::getInt() etc.

If you're talking about JParameter, which is the default class for handling configurations presented in the INI or XML files, you'll find the API docs helpful.

http://api.joomla.org/Joomla-Framework/Parameter/JParameter.html

However, in actual use in components, you should retrieve parameters from JFactory::getConfig() for global parameters, or for component parameters:

$config =& JComponentHelper::getParams( 'com_name' ); // where com_name is the component name

The API wiki should also help:

http://docs.joomla.org/Framework

bucabay
thanks bucabay. But what I'm looking for is a way the for my component link(from the link built in com_menus) to link to a enter page of my component. JParameter creates its own data stored in a different place of the database. What I mean by "urlparams" is the input name the core components(Poll, Articles...) use in com_menus to accomplish what I'm trying to do.
I still don't get what you mean sorry. It will probably help you to look at the source of one of the joomla core components.
bucabay
A: 

JRequest::getVar('name', 'default value'); Also check http://docs.joomla.org/Framework

(wanted to upvote answer 1 but wouldn't let me until I get more points.. so I'm giving the same in short answer form)

relativityboy
relativityboy but thats not what I was looking for but I wasn't that clear. I want a way to link to an internal page of a custom component from the menu without having to use a external url. Do you know a way to do this?
A: 

Why exactly can't you just you just use an External Link menu type?

This is what I do. Just give it a relative link rather than an absolute one:

index.php?option=com_components&task=blah

Presumably this isn't any different from constructing a URL to execute a command inside your component.

humble coffee
Hi humble coffee, Thanks for your comment. Modules can only be placed on pages with a real menu link. Also, I'm trying to make it as easy as possible for my end users. If Joomla is really a platform of development, I shouldn't have to hack around this issue. Core components can achieve this I'm not sure why my custom components can't.