New problem with PHP plugin

16 years 7 months ago #2491 by Arnaud
Hi Emir !

I have a problem with a PHP Plugin i'm trying to develop (latest news). I can't find what's wrong with my code, so your help would be very appreciate !

I pass a variable in my url to filter on my news categories. Here is my URL with my variable 'cat' :

index.php?option=com_content&task=section&id=1&Itemid=2&cat=13


Now, here is my PHP code to extract my variable content :
$url = $_SERVER['QUERY_STRING'];
parse_str($url, $output);
$cat = $output['cat'];

And now my SQL code :
$query = "SELECT count(id) FROM #__content WHERE sectionid = '1' AND catid = $cat AND state = '1'";

When i execute my module, i have no result (Loading...). If i set the debug mode on, i can see my variable is passed :
SELECT count(id) FROM jos_content WHERE sectionid = '1' AND catid = 13 AND state = '1'

But, if i manually set "$cat = 13" in my php code, i have my module result !

I don't know why it's not working... Is there a problem with my PHP code or with the API ?

Thank you for your help, Emir !

Arnaud

Please Log in or Create an account to join the conversation.

16 years 7 months ago #2492 by Arnaud
I've activated debug mode in the plugin and I can see the content.

So the problem come from the API !

Emir ! Help, please ! :D

Please Log in or Create an account to join the conversation.

16 years 7 months ago #2499 by Saka
Please attach the plugin so I can test.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

16 years 7 months ago #2500 by Arnaud
Check MP, Emir ;)

Please Log in or Create an account to join the conversation.

16 years 7 months ago #2504 by Arnaud
Hi Emir !

Do you have information about my plugin issue ?

Arnaud

Please Log in or Create an account to join the conversation.

16 years 7 months ago #2505 by Saka
Not yet, I've been busy. Will check that soon.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch