Welcome, Guest
Username Password: Remember me

What parameters working when? Way to copy?
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: What parameters working when? Way to copy?

What parameters working when? Way to copy? 19 Apr 2009 19:14 #787

I originally set up all my parameters (which are extensive to create the layout I want) in a menu item rather than the component defaults, because I had a bad experience of losing the default ones when I upgraded the version. But now I'm not using a menu item to access the component at all - I pominently display the module and let people get to the component just by the link at the bottom of the module. My original menu that has the menu item with my parameters has not be deleted, but is not showing at all anymore. Amazingly, the component as invoked by the module's link still uses the parameters set in that unused menu item - I have no idea why. I'm afraid that one day I'll do spring cleaning and delete all unused items, and suddenly Bible Study will stop working. Here are my questions:

1) Why is it using the parameters of an unused menu item? If theoretically I had two menu items with different parameters, how would it know which one to pick? I would think it would be way more logical for the module's link to use the component's defaults, but...

2) I would feel more comfortable setting the component defaults and deleting the menu item. So is there a way to copy the parameters from the menu item to the component defaults, using PHPMyAdmin or something? I don't know how the structure of menu items works, so without a tip from an expert it would probably be even slower to figure it out on my own than to copy the parameters one by one manually.
Joomla 1.5.10, Bible Study 6.0.11

Re:What parameters working when? Way to copy? 20 Apr 2009 07:45 #793

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
The module is supposed to be picking up it's own parameters. The component will hold on to the Itemid of the menu item and load the parameters based on that menu item. Check to be sure it's not the module's parameters that it's picking up.

It shouldn't be that hard to look at jos_menu for the one pointing to the biblestudy listing - there is a field (I think it is called parameters) that you can cut and paste to another table. In fact, you could also back up your parameters that way. I believe what Joomla does is combines any old fields it finds in the parameters that have a corresponding field name in the current xml file, and then adds blanks after the new fields.

Just be aware that in a future version (a version 7x) we will be moving away from the large number of parameters. Listings will be done by creating templates in the backend then choosing that template when you make a listing or a module view. There will be some items in the parameters, like filtering for a teacher, book, etc.

At that point we will look at whether we can rescue and reuse existing parameters or whether users will have to build them from scratch. The good news is that it will be much simpler and the user will have a lot more control over the way the listings look than ever.
"You shall know the truth and the truth shall set you free." JC

Re:What parameters working when? Way to copy? 20 Apr 2009 18:09 #794

The module is supposed to be picking up it's own parameters. The component will hold on to the Itemid of the menu item and load the parameters based on that menu item. Check to be sure it's not the module's parameters that it's picking up.
I don't think I fully understood that paragraph, because it sounded like it contradicted itself. My module and component layouts are quite different, so I'm not confusing the two. The module's layout is clearly based on the module's parameters - that's working fine. The component is basing its layout on the parameters of a no-longer-used menu item.
It shouldn't be that hard to look at jos_menu for the one pointing to the biblestudy listing - there is a field (I think it is called parameters) that you can cut and paste to another table.
Well, it was harder than you think - the two parameter lists were not in the same order, and because many of the menu item parameter values were blank (for "Use Global") I couldn't just copy them in large blocks or I would have wiped out the default values. Anyway, it took about a half hour, but I got there. Also, at the time I did the copy, the component parameter list had three copies of most of the parameters for some weird reason; later, after I changed a parameter, it was rewritten with just one.

Then I deleted the old menu and all its menu items, including the Bible Studies one. I assumed at that point that the master parameters set in the component manager would be in control.

But it's not so! After doing all that, I changed one of the component parameters (a color in one of the spans), saved, went to my site and refreshed, but the color didn't change! I checked the parameters using PHPMyAdmin, and it was definitely changed. So now what do I do? My old menu item isn't even in the menu trash can, because I not only deleted the items, but the menu itself, which appears to get rid of all related items completely (I guess because they are orphaned). Where in the world is the component getting its information from?
Joomla 1.5.10, Bible Study 6.0.11

Re:What parameters working when? Way to copy? 21 Apr 2009 09:29 #797

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
Sorry you are having trouble. You are sure it's not just your cache that is holding on to the old page?

In obtaining paramters, this is the method we are told to use: $params = &$mainframe->getPageParameters();

The function (copied below) looks for the component name ($option) and the active menu. It then pulls the parameters from the menu item parameters field. JRequest is the REQUEST variable. Not sure if this helps you or not. You might view your html source too - could be a coding error on one of those span tags.

function &getParams($option = null)
{
static $params = array();
$hash = '__default';
if(!empty($option)) $hash = $option;
if (!isset($params[$hash]))
{
// Get component parameters
if (!$option) {
$option = JRequest::getCmd('option');
}
$params[$hash] =& JComponentHelper::getParams($option);

// Get menu parameters
$menus =& JSite::getMenu();
$menu = $menus->getActive();

$title = htmlspecialchars_decode($this->getCfg('sitename' ));
$description = $this->getCfg('MetaDesc');

// Lets cascade the parameters if we have menu item parameters
if (is_object($menu))
{
$params[$hash]->merge(new JParameter($menu->params));
$title = $menu->name;

}

$params[$hash]->def( 'page_title' , $title );
$params[$hash]->def( 'page_description', $description );
}

return $params[$hash];
}
"You shall know the truth and the truth shall set you free." JC

Re:What parameters working when? Way to copy? 21 Apr 2009 23:44 #798

Yes, I'm sure no cache is involved - I am not using cache at all, and even if I was, everything changes fine except this. Also, it's not just something wrong with a span tag - I tried changing several other parameters - it is definitely ignoring (or overriding) my component parameters and getting its instructions from who-knows-where.
It then pulls the parameters from the menu item parameters field.
The problem is that there is no longer any menu item in my whole site, even disabled, that calls Bible Study! I see from the code you provided that it is getting the component parameters first and then cascading parameters from a menu item, but what menu item??? That's the mystery.

What file is that code in? Perhaps I could add some Jdump calls to try to figure out where it thinks there is a menu item. That is, if I can figure out how to get a menu ID or something else like that from those objects somehow... I'm very unfamiliar with Joomla object structure.
Joomla 1.5.10, Bible Study 6.0.11

Re:What parameters working when? Way to copy? 22 Apr 2009 08:10 #802

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
The file is document.php and it's located in /libraries/joomla/document.

In theory, I suppose, the component might take parameters from the global parameters field in the jos_component table if there is no corresponding menu for the PageParameters to come from - but that is just a guess.

Sadly, the Joomla API is not well documented and sometimes we developers are flying blind.
"You shall know the truth and the truth shall set you free." JC
  • Page:
  • 1
  • 2
Moderators: Darren Vandermyde, Kyle
Time to create page: 0.62 seconds