Forums

cc3 to cc5

MeneerKees 02 Apr, 2015
L.s.
I found this piece of code for making a multiple selection from a database within CC3.1 It's from the greyhead book,
and goes in to the where box in cc3
But I dont know how to addapt it for CC5,
Can any body help??

<?php
// create the empty array
$where = array();
// check the text filter
$filter_text = JRequest::getString('filter_text', '', 'post');
if ( $filter_text ) {
$where[] = "( `title` LIKE '%$filter_text%'
OR `introtext` LIKE '%$filter_text%'
OR `fulltext` LIKE '%$filter_text%' )";
}
// check the catid filter
$filter_catid =& JRequest::getVar('filter_catid', array(), 'post', 'array');
if ( count($filter_catid) ) {
$filter = implode(', ', $filter_catid);
$where[] = " `catid` IN ($filter) ";
}
if ( count($where) ) {
$where = implode(' AND ', $where);
echo " WHERE $where ";
}
?>
Max_admin 02 Apr, 2015
Hi Meneer,

v5 is totally different, my suggestion is that you open the FAQs > CCv5 section and read the available v5 tutorials, most tasks became easier to accomplish and there are many more features.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
MeneerKees 09 Apr, 2015
Thanks Max,

After some searching, I found the solution.
I wrote a form in witch I select te search paramaters and acces them in my connection via:
$szoekdatum = JRequest::getVar('datepicker29'); using some php I create a specific seach string for my return array.
$scriteria = "vv.".$sdatum." = '1' OR vv.".$sdatum." = '2' "; // where vv is the model.
return array(":{$scriteria}");
Works fine,

But when I add a sorting to my listing, and use it the Jrequest returns an empty value, this shows from the debug-info
so I can load a connection-list, but not sort it

Any suggestions what I did wrong or have missed.
or perhaps there us an other way to pass data from a form to cc5

Regards,

Gerald
Max_admin 09 Apr, 2015
Hi Gerald,

If you are passing external vars then try to add their names to the "Stored fields" box under the front/admin listing area.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
MeneerKees 09 Apr, 2015
Hello Max,

Thanks for your swift responce,
unfortunatly, it didn't work,
The var I use comes from a form and loads fine the first time, but gets lost when I sort the list in both front and admin view.
I also tried handing the value over like this:
$szoekdat = JRequest::getVar('datepicker29');       //loads fine once
if ( $szoekdat[2] = "-") {                                            //checks against string format (dd-mm-yyyy)
         $_SESSION["zoekdatum"] = $szoekdat ;       //stores value if string is ok
} else {
          $szoekdat = $_SESSION["zoekdatum"];        //load old value if string not OK
}

but for some reason it won't save to the $_SESSION

would it be possible to load the var from an other database I link to the form I use, and if so how?

Thanks

Gerald
GreyHead 10 Apr, 2015
Hi MeneerKees,

The 'if' clause in your code looks as if it will always fail without unless the value is an array with a dash in the third element. I'm not at all sure that is correct.

Also I'm not sure that you can write directly to $_SESSION. The Joomla! code for this is
<?php
$session = JFactory::getSession();
$session->set('param_name', 'value');
?>

Bob
MeneerKees 10 Apr, 2015
Hello Bob,

Thank you for your input.
I checked with a few echo statements, witch values were returned by the php and if, the if statement work. It did
I then replaced my session request with yours, it gave me the same result.

For some reason everything loads fine, but when I sort the list, al data in session and the form-array is lost.
Could that perhaps be some settings problem? (the particular user stays logged in fine, an should therefore have a session().

Perhaps I could load the variabels from an array since that is real permanent data and the primary data is obtained via a form and alraidy saved to a database for future reference.

I just dont know how to call a single value within my PHP.

Thanks,

Gerald,
(MeneerKees is just my nickname in Dutch),
MeneerKees 10 Apr, 2015

Hello Bob,

Perhaps I could load the variabels from anπŸ˜› array (I ment database sorry) πŸ˜› since that is real permanent data and the primary data is obtained via a form and alraidy saved to a database for future reference.

I just dont know how to call a single value within my PHP.

Thanks,

Gerald,
(MeneerKees is just my nickname in Dutch),

Max_admin 11 Apr, 2015
Hi,

Did you try to put the variable name in the "Stored fields" box as I suggested before ? if the parameter is called "datepicker29" then just put "datepicker29" inside that box

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
MeneerKees 11 Apr, 2015
Hello,

Tried it , even made a new clean connextion, copied the bare essentiels, and put "datepicker29" in the stored fields box.
This only resulted in an error:
Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/id90804/public_html/libraries/cegcore/libs/arr.php(60) : eval()'d code on line 1

Regards,


Gerald
MeneerKees 11 Apr, 2015
Answer
Hello,

I found a work-around.
I removed the connexion-action form my form and replaced it with a redirect, sending with it the value of datepicker29.
This topic is locked and no more replies can be posted.