<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : Question about Json requests</title>
		<link>https://www.cotonti.com</link>
		<description>Last topic posts</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Thu, 23 Apr 2026 22:20:05 -0000</pubDate>

		<item>
			<title>Trustmaster</title>
			<description><![CDATA[<p>In the above example fetchAll() method always returns an array of arrays, not objects.</p>
]]></description>
			<pubDate>Wed, 27 Mar 2013 10:45:42 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=7389&d=0#post37316]]></link>
		</item>
		<item>
			<title>Sergey</title>
			<description><![CDATA[<p><span lang="en" xml:lang="en"><span class="hps alt-edited">Function </span></span>j<strong>son_encode</strong> <span lang="en" xml:lang="en"><span class="hps alt-edited">does not work</span> <span class="hps">correctly.</span> <span class="hps">It is</span> <span class="hps">with a large array</span> <span class="hps">of data gives</span> <span class="hps">an error when processing</span> <span class="hps">objects and arrays.</span> <span class="hps">This function</span> <span class="hps">corrects</span> <span class="hps">the errors.</span> <span class="hps">In the form,</span> <span class="hps">I keep</span> <span class="hps">the contents of</span> <span class="hps">pages, it</span> <span class="hps">increases the rate of</span> <span class="hps">conversion</span> <span class="hps">of pages</span> <span class="hps">in a friendly</span> <span class="hps">layout</span></span>:</p>

<pre class="brush:php;">
function object_in_array   	// 	преобразование структуры в массивы. исправление косяка json_decode
	(                       // 	внимание! функция рекурсивная.
 	$объект			//	@param  - сложная структура состоящая из объектов и массивов
  	)
{
if	(!is_object($объект) and !is_array($объект))	return $объект;
if	(is_object($объект))	$объект = get_object_vars($объект);
return array_map('object_in_array',$объект);
}</pre>

<p> </p>
]]></description>
			<pubDate>Wed, 27 Mar 2013 08:59:42 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=7389&d=0#post37315]]></link>
		</item>
		<item>
			<title>Trustmaster</title>
			<description><![CDATA[<p>It's as simple as this:</p>

<pre class="brush:php;">
&lt;?php defined('COT_CODE') or die('Wrong URL.');
/* ====================
[BEGIN_COT_EXT]
Hooks=ajax
[END_COT_EXT]
==================== */

if ($usr['id'] &gt; 0 &amp;&amp; COT_AJAX)
{
	require_once cot_incfile('pm', 'module');
	if ($usr['newpm'])
	{
		echo json_encode($db-&gt;query("SELECT * FROM $db_pm WHERE pm_touserid=? AND pm_tostate=0", $usr['id'])-&gt;fetchAll());
	}
}</pre>

<p> </p>]]></description>
			<pubDate>Wed, 27 Mar 2013 06:29:55 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=7389&d=0#post37314]]></link>
		</item>
		<item>
			<title>Dyllon</title>
			<description><![CDATA[<p>I'm looking to create something similar to Cotonti.com's private message feature. I've been browsing around through the source code, but I don't know how to achieve it. From what I gather, this is the main part of it on the javascript end:</p>

<pre class="brush:jscript;">
$.getJSON('index.php?r=pm_json', function(data)
{	
	var rows = '&lt;ol&gt;';
	$.each(data, function(key, val)
	{
		console.log(val);
		var url = 'pm?m=message&amp;amp;id=0'.replace('0', val.pm_id);
		rows += '&lt;li&gt;&lt;a href="'+url+'"&gt;'+val.pm_title+'&lt;/a&gt;&lt;small&gt;Sender: '+val.pm_fromuser+'&lt;/small&gt;&lt;/li&gt;';
	});
	rows += '&lt;/ol&gt;';
	$('#pmbox').prepend(rows);
});</pre>

<p>I just can't seem to figure out how to PHP side of it goes. Any insight?</p>
]]></description>
			<pubDate>Tue, 26 Mar 2013 18:01:00 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=7389&d=0#post37313]]></link>
		</item>
	</channel>
</rss>