<ol> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$tid</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">227</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// WARNING :)</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">(</span><span style="color: #0000ff;">"SELECT gid, realm FROM {domain_taxonomy_access} WHERE tid = :tid AND (realm = 'domain_id' OR realm = 'domain_site')"</span><span style="color: #339933;">,</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">':tid'</span> <span style="color: #339933;">=></span> <span style="color: #000088;">$tid</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">(</span><span style="color: #000088;">$result</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$data</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #666666; font-style: italic;">// Transform the 0 to -1, since {domain_access} is unsigned.</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">(</span><span style="color: #000088;">$data</span><span style="color: #339933;">-></span><span style="color: #004000;">gid</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">)</span> ? <span style="color: #000088;">$gid</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$gid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #339933;">-></span><span style="color: #004000;">gid</span><span style="color: #339933;">;</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #b1b100;">print</span> <span style="color: #000088;">$gid</span><span style="color: #339933;">;</span> </div></li> <li style="font-family: monospace; font-weight: normal;"><div style="font-family: monospace; font-weight: normal; font-style: normal"> <span style="color: #009900;">}</span> </div></li> </ol>
Комментарии
Если у вас есть вопрос, критика или другое мнение - напишите в комментариях.