There is a new full manual available for Chronoforms6 in the downloads page, follow us on twitter for the latest news and updates: https://twitter.com/chronoengine

Old known Problem with Itemid

mikezf , May 16 at 11:06
m
mikezf

Hi Max,
because I still cannot resolve the Problem with the wrong Itemid of two different Chronoconnections called ones from another, I would like to define this in the "Suggestions/Hacks" Section of CC6. Maybe you can change something in CC6 to solve my problem.

Once again:
I call the Connection "CA" with a Joomla Menu. The Itemid for this menu item is eq. 150.
From the Connection "CA" it is called a Form "FA" with detail view of the selected row. -> Itemid is still 150. OK.
Now from "FA" I call the second Connection "CB" with {connection:CB/index} . -> Itemid is still 150, not OK.
Not OK, because there are Joomla Modules connectet with Itemid. And it should be Modules connected with Itemid 151,
from the hidden menu item of Connection "CB". But it is not the gratest Problem. This one comes as next.
As next step I want to call a Form "FB" to view details of the selected row from "CB". And what happen? Itemid is still 150.
There is viewed the wrong Form "FA" and not the right "FB". If I change manually in the address line the value of Itemid
from 150 to 151, the right form come through as a wonder. And of course the right Joomla modules.

What do i suspect?
The URL of the Connection "CA" is: index.php?option=com_chronoconnectivity6&view=connection&Itemid=150
The URL of the Connection "CB" is: index.php?option=com_chronoconnectivity6&view=connection&Itemid=151
The only difference is in Itemid.

I saw there are two different way to call a connection:
Type 1: index.php?option=com_chronoconnectivity6&view=connection&Itemid=151
Type 2: index.php?option=com_chronoconnectivity6&cont=manager&conn=CA&Itemid=151

I did a test in Custom View:
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
$menuItem = $menu->getItems( 'link', 'index.php?option=com_chronoconnectivity6&cont=manager&conn=CA', true );
echo 'Itemid='.$menuItem->id;
?>
Resulting Itemid is null and not 150. Why? I suppose because there is no menu item for such url type 2.
There is only for the type 1 of url.
And calling the function getitemid() with url "index.php?option=com_chronoconnectivity6&view=connection"
cannot get Itemid of the corresponding menuitem, because there is no name of the connection appanded.

Solution:
I do not know if I am right.
Can you change the art how Joomla build the url of the menuitem for the connection, so the url clearly indicates
the right connection with the connection name. Maybe right that:

index.php?option=com_chronoconnectivity6&view=connection&conn=CA

Add as url parameter the name of the connection. Maybe it helps.

Regards,
Mike

admin

Hi Mike,

The way the latest few versions work is that it uses the "current" url in all views which needs a url, so if the current url has Itemid then the link will have that too, you need to design your app with that in mind.

But what if you want to get rid of any of the currently active url parameters for some reason ? you need to explicitly set this parameter in the link parameter of the view to an empty string, example, use a "Link" view and in the "url parameters" use this:


That should clear the Itemid parameter from the href tag of that Link view only.

If this is not working for you then please download and install the latest CFv6 update, if it is still not working then please wait for the next official update, hopefully coming by the weekend or send me a message using the "Contact us" page.

Best regards,
Max

If your main question got answered then please mark the answer using the button!

m
mikezf

Hi Max,
OK. With "Itemid=" this parameter has been removed from the href tag.
But then the second connection will be called without Itemid set and Joomla gets creasy
and do not know which modules to show.
Another issue is that there is possible to unset only one parameter. "Itemid= param2=" is not working.

My suggestion is to change the href of the created menuitems for connections same as the href
got by {connection/url:event}. Then using:
$menu->getItems( 'link', 'index.php?option=com_chronoconnectivity6&cont=manager&conn=conn_name', true );
(virtually as: $menu->getItems( 'link', {connection/url:conn_name}, true );, but this feature is not implemented)
gives the right Itemid to append at the href of the second connection.

Regards,
Mike

admin

Hi Mike,

you can unset more than 1 parameter this way:

				
param1=&param2=


If you omit the Itemid then Joomla does not assign a specific menu item settings, if this is a problem then you can pass any Itemid you like, if you want to get the Itemid of another connection then you can get it using the PHP code you have inside a PHP function and return the result, then you can use it as a variable anywhere with this syntax:
				
{var:php_fn_name}


Best regards,
Max

If your main question got answered then please mark the answer using the button!

m
mikezf

Hi Max,
I had a long break because of job change. But now I am back to check new features of CC.
I think there is an easy way to solve my problem with correct Itemid.
Is it possible to change the way the connection is colled from a menu item. Now the generated link is:

A) index.php?option=com_chronoconnectivity6&view=connection

Can you change this to:

B) index.php?option=com_chronoconnectivity6&cont=manager&conn=[CC Name]

I could then get the Itemid of the another CC calling this function:

JFactory::getApplication()->getMenu()->getItems( 'link', 'index.php?option=com_chronoconnectivity6&cont=manager&conn=[CC Name]', true )->id;

because in B) there is the CC Name in link, in A) there is not.

Best regards,
Mike

admin

Hi Mike,

I think the main issue here is how you are managing the application you have, I suggest that you have your main connection under a menu item, and if you want to navigate to another connection then use the full connection link or create another menu item for that connection and use it everywhere.

Best regards,
Max

If your main question got answered then please mark the answer using the button!

m
mikezf

Hi Max,
thank you for your quick response.
Sorry for my poor English, so I suppose I did not express myself clearly enough. I would try to say it again
with another words. I do not want to use absolute link to connections. That changes from installation to installation.
I want to automate this. And I can do this only if Joomla knows the menu link, I have created, to the another connection.
Only then I can get the right Itemid for the another connection, assuming that there is a menu link for every connection.
And I do so. Why do I so, why do I create every connection as separate project/connection? Because every of my
connection are simmilar to another and I can just copy the code form one connection to another, using same
events, views etc., only the connection name and some modificatons and labels are different.
I noticed that if I do not use different Itemid for every connetion, then Joomla and Chronoengine get crazy.
Instead of viewing e.g. second connection view, it is the first connection viewed. Strange!
But with creating menu items (e.g. as hidden menu) for every connection and using proper Itemd in links,
everything seems to be correct.
What I want from you is simple.

With tag
connection/url:connection-name}
the resulting url is:
index.php?option=com_chronoconnectivity6&cont=manager&conn=connection-name&event=index

But in Joomla the url of the created menu item is:
index.php?option=com_chronoconnectivity6&view=connection

Both links are diferent, the second one do not contain the connection-name!
I think the second one is only used in menu link and nowhere in code.

Can you please make a little extention/change, when creating a menu item the first type of link
will be createt, not the second one? I you want backwards compatibility, add a switch in menu option
for old type of link or new type.

I hope you can understand me and managed this. I would pretty test this at first so you can be sure.

Regards,
Mike

admin

Hi Mike,

The menu link created by Joomla should have the Item_id which makes it unique, how do you link from one connection to another ? could you please send me a small demo backup file ? or tell me the steps to follow and I will run a test.

Best regards,
Max

If your main question got answered then please mark the answer using the button!

m
mikezf

Hi Max,
I want to thank you for taking the time to resolve my problem with Itemid.
I can give you access to the installation, it's for testing purpose. Tell me please if that way would be OK.
Because the tag {connection:contact_list} use another url notation as the Joomla url to the defined menu,
I use this tag but in the redirect function with url option: {connection/url:contact_list/index},
appending url parameter Itemid. And Itemid I get with the PHP:
$app = JFactory::getApplication();
$menu = $app->getMenu();
$menuItem = $menu->getItems( 'link', 'index.php?option=com_chronoconnectivity6&cont=manager&conn=contact_list', true );
return $menuItem->id;
This is working ONLY after I changed with phpmyadmin the original Joomla menu link for the connection contact_list
from original:
index.php?option=com_chronoconnectivity6&view=connection
to requested:
index.php?option=com_chronoconnectivity6&cont=manager&conn=contact_list

So in this sense if it could be managed by you it will be great.
Regards,
Mike

m
mikezf

Hi Max,
one step forward.

The function PHP:
$url = $this->Parser->parse('{connection/url:client_list}', true);
gets the url to the connection 'client_list'. But! The resulting link is, hier e.g.:
'/index.php?option=com_chronoconnectivity6&cont=manager&conn=contact_list&event=index&Itemid=144'
So, the url is extended by '&event=index&Itemid=number'.
'event=index' means, the url links to the default event. That's OK.
'Itemid=number' is hier obsolate. At first: it is the Itemid of the calling connection menu item (from where
the PHP function was called), second: Itemid in url as the parameter in menuItem = $menu->getItems( 'link', $url, true );
breaks this function and gets null. The $url cannot contain the Itemid, because Itemid has yet to be determined.
I would therefore suggest to build the menu item link extended by the default event:
'/index.php?option=com_chronoconnectivity6&cont=manager&conn=contact_list&event=index'
I can use then this funktion to determine the right Itemid of the colled connection:

$url = $this->Parser->parse('{connection/url:contact_list}', true);
$app = JFactory::getApplication();
$menu = $app->getMenu();
//$menuItem = $menu->getItems( 'link', 'index.php?option=com_chronoconnectivity6&cont=manager&conn=contact_list&event=index', true );
$menuItem = $menu->getItems( 'link', $url, true );
return $menuItem->id;

and use the result in the redirection funtion as parameter (e.g.):
Redirect URL: {connection/url:contact_list/index}
URL Parameters: client_id={data:client_id} Itemid={var:contact_Itemid}

Best regards,
Mike

m
mikezf

Hi Max,
is it possibile that with the last CF update the parse function gets no more the Itemid as I described before?
Have you found any free time to investigate the menu link construction aproach? This is not an urgent problem, so give yourself time.

Best regards,
Mike

m
mikezf

Hi Max,
I wanted to make a modest reminder.
I know that you are very busy and there are many more important matters than mine.
Maybe if you ever found a free moment, could you look at my problem?

Best regards,
Mike

PS: Chronoforms and Chronoconnectivity are the best forms frameworks I ever saw.

Powered by ChronoForums - ChronoEngine.com

ChronoForms Book

The ChronoForms Book, written for ChronoForms v3 contains 350 pages of invaluable ChronoForms How-tos hints and tips.

Note: many of the ideas can be used in ChronoForms v4 but the admin interface is very different and code examples may need to be modified.

Members Login

 

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for
goods and services provided by ChronoEngine.com