There is currently a piece of code like this {code ...} it is used to generate the corresponding ID record in the portal_article_related table after adding relevant articles, and then obtain the related fields in the portal_article_title table through the ID, you also need to use portal_artic... there is currently such a piece of code
$article['related'] = array();if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) { foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) { $value['uri'] = fetch_article_url($value); $article['related'][$raid] = $value; } }
It is used to generate the corresponding ID record in the portal_article_related table after adding relevant articles, and then obtain the related fields in the portal_article_title table through the ID, you also need to use the catid in the portal_article_title table to obtain relevant records in the portal_category table. how can I write this?
Thank you.
Reply content:
There is currently such a piece of code
$article['related'] = array();if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) { foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) { $value['uri'] = fetch_article_url($value); $article['related'][$raid] = $value; } }
It is used to generate the corresponding ID record in the portal_article_related table after adding relevant articles, and then obtain the related fields in the portal_article_title table through the ID, you also need to use the catid in the portal_article_title table to obtain relevant records in the portal_category table. how can I write this?
Thank you.
Simply write an SQL statement. you don't need to write this AR statement.
Even native SQL statements can be easily implemented