I have set up a Connection with a 'where' clause to query a database. When linking to the Connection directly with a URL in my browser, I am able to pass a parameter. for example:
http://******.com/index.php?option=com_chronoconnectivity5&cont=lists&act=index&ccname=my_event_instances&eventid=5
generates this GET array:
Array
(
[option] => com_chronoconnectivity5
[cont] => lists
[act] => index
[ccname] => my_event_instances
[eventid] => 5
)
and the 'WHERE' clause I set up in the Connection:
<?php
$var = \JRequest::getVar('eventid','', 'get');
$user =& JFactory::getUser();
return array('rt_event_id'=> strval($var),"user_id" => $user->id );
?>
results in the expected Select from the table.
However, this doesn't seem to work from a the Chronoconnectivity plugin. When I try
{chronoconnectivity5}my_event_instances&eventid=5{/chronoconnectivity5}
I get an empty GET array, and the generated SQL has an empty string in the 'WHERE' clause.
I get the feeling the CC Plugin is not seeing the parameter. Does anyone have any suggestions?
Thanks
Steve
http://******.com/index.php?option=com_chronoconnectivity5&cont=lists&act=index&ccname=my_event_instances&eventid=5
generates this GET array:
Array
(
[option] => com_chronoconnectivity5
[cont] => lists
[act] => index
[ccname] => my_event_instances
[eventid] => 5
)
and the 'WHERE' clause I set up in the Connection:
<?php
$var = \JRequest::getVar('eventid','', 'get');
$user =& JFactory::getUser();
return array('rt_event_id'=> strval($var),"user_id" => $user->id );
?>
results in the expected Select from the table.
However, this doesn't seem to work from a the Chronoconnectivity plugin. When I try
{chronoconnectivity5}my_event_instances&eventid=5{/chronoconnectivity5}
I get an empty GET array, and the generated SQL has an empty string in the 'WHERE' clause.
I get the feeling the CC Plugin is not seeing the parameter. Does anyone have any suggestions?
Thanks
Steve
Hi Steve,
There may be a shorter name but this should give you the value
Bob
There may be a shorter name but this should give you the value
$this->view->controller->data['eventid']
Bob
Thanks for the suggestion Bob, but to be honest it's not clear to me how I should deploy this code snippet :-)
If it helps to clarify what's going on, I opened the page source of the page with the plugin, and this is what I get:
The original plugin is:
{chronoconnectivity5}my_event_instances&eventid=5{/chronoconnectivity5}
The code being returned is:
<form action="/index.php/component/chronoconnectivity5/?cont=lists&ccname=my_event_instances" method="post" name="admin_form" id="admin_form">
So I'm just a little confused as to where the parameter went. If I use that url and add the parameter to the end manually, it works.
If it helps to clarify what's going on, I opened the page source of the page with the plugin, and this is what I get:
The original plugin is:
{chronoconnectivity5}my_event_instances&eventid=5{/chronoconnectivity5}
The code being returned is:
<form action="/index.php/component/chronoconnectivity5/?cont=lists&ccname=my_event_instances" method="post" name="admin_form" id="admin_form">
So I'm just a little confused as to where the parameter went. If I use that url and add the parameter to the end manually, it works.
Hi Steve,
Have you tried this:
Bob
Have you tried this:
<?php
$user = JFactory::getUser();
return array('rt_event_id' => $this->view->controller->data['eventid'], 'user_id' => $user->id );
?>
Bob
Hi,
You may also try this code to capture the variables passed to the plugin:
Regards,
Max
You may also try this code to capture the variables passed to the plugin:
\GCore\Libs\Request::data("eventid")
Regards,
Max
Hi Max
Here's what I've tried:
Generates:
and
Generates:
How can I convince myself that the plugin is actually picking up the parameter and doing something with it? I assume I should be able to see the parameter in the code returned by the plugin placeholder in the page, but I don't.
Thanks for your help, by the way. It's much appreciated.
Steve
Here's what I've tried:
{chronoconnectivity5}my_event_instances&eventid=5{/chronoconnectivity5}
return array('rt_event_id' => \GCore\Libs\Request::data("eventid"), 'user_id' => $user->id );
Generates:
WHERE `myevents`.`rt_event_id` IS NULL AND `myevents`.`user_id` = '653'
using the plugin
and
WHERE `myevents`.`rt_event_id` = '5' AND `myevents`.`user_id` = '653'
when adding &events=5 directly to the code the plugin generates.
return array('rt_event_id' => $this->view->controller->data['eventid'], 'user_id' => $user->id );
Generates:
WHERE `myevents`.`rt_event_id` IS NULL AND `myevents`.`user_id` = '653'
in both cases
return array('rt_event_id'=> strval($current_event),"user_id" => $user->id );
Generates:
WHERE `myevents`.`rt_event_id` = '' AND `myevents`.`user_id` = '653'
using the plugin and
WHERE `myevents`.`rt_event_id` = '5' AND `myevents`.`user_id` = '653'
when adding the parameter directly.
How can I convince myself that the plugin is actually picking up the parameter and doing something with it? I assume I should be able to see the parameter in the code returned by the plugin placeholder in the page, but I don't.
Thanks for your help, by the way. It's much appreciated.
Steve
This topic is locked and no more replies can be posted.