迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費且不限制商業(yè)使用,是免費開源的產(chǎn)品,以萬端互聯(lián)為設(shè)計理念,支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
關(guān)聯(lián)字段如何在被關(guān)聯(lián)模塊里面顯示
我在A模塊里面關(guān)聯(lián)了B模塊的對象,如何在B模塊里面便利所有關(guān)聯(lián)的A呢?
FIND_
參考文檔:《條件循環(huán)修飾符、通配符》
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
是用FIND_嗎?
怎么用呢?
回復(fù)@迅睿框架技術(shù)-吳金輝
B是沒有主動關(guān)聯(lián)A的,只有A關(guān)聯(lián)了B,如何在B中查詢與自己關(guān)聯(lián)的A
你說說你的情況,我直接把代碼給你寫出來
B的show.html
{module module=A FIND_字段=$id}
{/module}
遍歷到了所有的news數(shù)據(jù),沒有過濾
代碼發(fā)一下,不要截圖
回復(fù)@逍遙游
FIND_xgjd
這個xgjd是A里面的關(guān)聯(lián)字段
"xgwa2": [ {module module=news FIND_xgjd=$id return=x} { "id":"{$x.id}", "title":"{$x.title}", "thumb":"{dr_thumb($x.thumb)}", "url":"{$x.url}", "keywords":"{$x.keywords}", "description":"{$x.description}", "wzlx": "{$x.wzlx}" }{$count_item == $key_item + 1? '' : ','} {/module} ],
{module module=news FIND_xgjd=$id} {/module}{$id}{$debug}
復(fù)制我的代碼看看數(shù)據(jù)給我看看
"xgwa2":
[
31<pre style="background-color: #f5f5f5; border: 1px solid #ccc;padding:10px; overflow: auto;"><p>SQL: SELECT * FROM `dr_1_news` WHERE `dr_1_news`.`status` = 9 ORDER BY `dr_1_news`.`updatetime` DESC </p><p>開發(fā)模式:已關(guān)閉</p><p>數(shù)據(jù)緩存:未設(shè)置</p><p>總記錄數(shù):4</p><p>分頁功能:未開啟</p><p>可用字段:id、catid、title、thumb、keywords、description、hits、uid、author、status、url、link_id、tableid、inputip、inputtime、updatetime、comments、avgsort、displayorder、wzlx、bendituijian、_inputtime、_updatetime、_bendituijian</p></pre> ],
FIND_xgjd沒有生效,程序版本是不是4.3.12,如果不是就用不了這個參數(shù)了,需要升級程序
我在4.3.12上面使用了,但是沒有效果,debug都出不了sql語句
{
"xgwa":
"id":"29",
"title":"測試資料2",
"thumb":"https://hmltravel.oss-cn-shenzhen.aliyuncs.com/202008/6e296ab61e719e7.png",
"url":"https://travel.hmltec.com/web/show-29.html",
"keywords":"123123",
"description":"是否",
"wzlx": "0"
},
"id":"30",
"title":"東方閃電1",
"thumb":"https://hmltravel.oss-cn-shenzhen.aliyuncs.com/202008/7dc4b0f5a017f94.jpg",
"url":"https://travel.hmltec.com/web/show-30.html",
"keywords":"ss|sdfsdf,等等",
"description":"這是描述",
"id":"25",
"title":"資料",
"thumb":"https://hmltravel.oss-cn-shenzhen.aliyuncs.com/202008/52a12daa74cbce3.jpg",
"url":"https://travel.hmltec.com/index.php?c=show&id=25",
"keywords":"填下江山|我是誰",
"description":"描述",
"id":"34",
"title":"d ",
"thumb":"https://travel.hmltec.com/static/assets/images/nopic.gif",
"url":"https://travel.hmltec.com/web/show-34.html",
"keywords":"",
"description":"d",
}, 31 ]
}
既然數(shù)據(jù)都有了,debgu肯定會有數(shù)據(jù)啊,你要用我的代碼測試,不要用你的代碼
31<pre style="background-color: #f5f5f5; border: 1px solid #ccc;padding:10px; overflow: auto;"><p>SQL: SELECT * FROM `dr_1_news` WHERE `dr_1_news`.`status` = 9 ORDER BY `dr_1_news`.`updatetime` DESC </p><p>開發(fā)模式:已關(guān)閉</p><p>數(shù)據(jù)緩存:未設(shè)置</p><p>總記錄數(shù):4</p><p>分頁功能:未開啟</p><p>可用字段:id、catid、title、thumb、keywords、description、hits、uid、author、status、url、link_id、tableid、inputip、inputtime、updatetime、comments、avgsort、displayorder、wzlx、bendituijian、ssgjz、ssgjzc、zdysx、liebiaotuce、_inputtime、_updatetime、_bendituijian、_ssgjz、_zdysx、_liebiaotuce</p></pre> ]
數(shù)據(jù)表明,參數(shù)未生效
{php $sql=urlencode('SELECT * FROM dr_1_news WHERE FIND_IN_SET ('.$id.', `xgjd`) order by updatetime desc');} {sql sql='$sql'} {/sql}
隨試一試這個
SQL語句也沒有FIND字段的表示啊
{if $_GET['mobile']}
"data":
{module module=MOD_DIR id=$id}
"id":{$id},
{php $sql=urlencode('SELECT * FROM dr_1_news WHERE FIND_IN_SET ('.$id.', `xgjd`) order by updatetime desc');}
{sql sql='$sql'}
{/sql}
]
{/if}
用這個,去掉你那些亂七八糟的代碼
除了id,我直接換成了31,其他都是你的。
還是系統(tǒng)故障
奇怪了,我本次用都可以,你這樣,使用phpmyadmin工具,然后把這句話放進去運行
這個字段是副表的
回復(fù)@迅??蚣芗夹g(shù)-吳金輝 是不是一定要主表
非常正確
參考文檔:《列表循環(huán)中調(diào)用模塊附表字段》
回復(fù)@迅睿框架技術(shù)-吳金輝 測試回帖
我是用在多個站點的,附表做join的方案效率不高。
打算這么干,在A模塊上傳數(shù)據(jù)的時候,同步到B模塊的數(shù)據(jù)里面去,這樣請求B的數(shù)據(jù)的時候,也不用每次都重新查詢一次A了。
所以,怎么在A模塊訪問B模塊的數(shù)據(jù),并修改呢?
因為cms字段格式創(chuàng)建好了就無法變更主附表類型,本插件支持將內(nèi)容模塊字段附表字段轉(zhuǎn)移為主...
轉(zhuǎn)為主表
FIND_
參考文檔:《條件循環(huán)修飾符、通配符》
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
是用FIND_嗎?
怎么用呢?
回復(fù)@迅睿框架技術(shù)-吳金輝
B是沒有主動關(guān)聯(lián)A的,只有A關(guān)聯(lián)了B,如何在B中查詢與自己關(guān)聯(lián)的A
你說說你的情況,我直接把代碼給你寫出來
B的show.html
{module module=A FIND_字段=$id}
{/module}
回復(fù)@迅??蚣芗夹g(shù)-吳金輝

遍歷到了所有的news數(shù)據(jù),沒有過濾
代碼發(fā)一下,不要截圖
回復(fù)@逍遙游
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
FIND_xgjd
這個xgjd是A里面的關(guān)聯(lián)字段
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
復(fù)制我的代碼看看數(shù)據(jù)給我看看
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
"xgwa2":
[
31<pre style="background-color: #f5f5f5; border: 1px solid #ccc;padding:10px; overflow: auto;"><p>SQL: SELECT * FROM `dr_1_news` WHERE `dr_1_news`.`status` = 9 ORDER BY `dr_1_news`.`updatetime` DESC </p><p>開發(fā)模式:已關(guān)閉</p><p>數(shù)據(jù)緩存:未設(shè)置</p><p>總記錄數(shù):4</p><p>分頁功能:未開啟</p><p>可用字段:id、catid、title、thumb、keywords、description、hits、uid、author、status、url、link_id、tableid、inputip、inputtime、updatetime、comments、avgsort、displayorder、wzlx、bendituijian、_inputtime、_updatetime、_bendituijian</p></pre> ],
FIND_xgjd沒有生效,程序版本是不是4.3.12,如果不是就用不了這個參數(shù)了,需要升級程序
我在4.3.12上面使用了,但是沒有效果,debug都出不了sql語句
{
"xgwa":
[
{
"id":"29",
"title":"測試資料2",
"thumb":"https://hmltravel.oss-cn-shenzhen.aliyuncs.com/202008/6e296ab61e719e7.png",
"url":"https://travel.hmltec.com/web/show-29.html",
"keywords":"123123",
"description":"是否",
"wzlx": "0"
},
{
"id":"30",
"title":"東方閃電1",
"thumb":"https://hmltravel.oss-cn-shenzhen.aliyuncs.com/202008/7dc4b0f5a017f94.jpg",
"url":"https://travel.hmltec.com/web/show-30.html",
"keywords":"ss|sdfsdf,等等",
"description":"這是描述",
"wzlx": "0"
},
{
"id":"25",
"title":"資料",
"thumb":"https://hmltravel.oss-cn-shenzhen.aliyuncs.com/202008/52a12daa74cbce3.jpg",
"url":"https://travel.hmltec.com/index.php?c=show&id=25",
"keywords":"填下江山|我是誰",
"description":"描述",
"wzlx": "0"
},
{
"id":"34",
"title":"d ",
"thumb":"https://travel.hmltec.com/static/assets/images/nopic.gif",
"url":"https://travel.hmltec.com/web/show-34.html",
"keywords":"",
"description":"d",
"wzlx": "0"
}, 31 ]
}
既然數(shù)據(jù)都有了,debgu肯定會有數(shù)據(jù)啊,你要用我的代碼測試,不要用你的代碼
回復(fù)@逍遙游
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
{
"xgwa":
[
31<pre style="background-color: #f5f5f5; border: 1px solid #ccc;padding:10px; overflow: auto;"><p>SQL: SELECT * FROM `dr_1_news` WHERE `dr_1_news`.`status` = 9 ORDER BY `dr_1_news`.`updatetime` DESC </p><p>開發(fā)模式:已關(guān)閉</p><p>數(shù)據(jù)緩存:未設(shè)置</p><p>總記錄數(shù):4</p><p>分頁功能:未開啟</p><p>可用字段:id、catid、title、thumb、keywords、description、hits、uid、author、status、url、link_id、tableid、inputip、inputtime、updatetime、comments、avgsort、displayorder、wzlx、bendituijian、ssgjz、ssgjzc、zdysx、liebiaotuce、_inputtime、_updatetime、_bendituijian、_ssgjz、_zdysx、_liebiaotuce</p></pre> ]
}
數(shù)據(jù)表明,參數(shù)未生效
回復(fù)@逍遙游
隨試一試這個
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
SQL語句也沒有FIND字段的表示啊
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
{if $_GET['mobile']}
{
"data":
{module module=MOD_DIR id=$id}
{
"id":{$id},
"xgwa":
[
{php $sql=urlencode('SELECT * FROM dr_1_news WHERE FIND_IN_SET ('.$id.', `xgjd`) order by updatetime desc');}
{sql sql='$sql'}
{/sql}
]
}
{/module}
}
{/if}
用這個,去掉你那些亂七八糟的代碼
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
除了id,我直接換成了31,其他都是你的。
還是系統(tǒng)故障
奇怪了,我本次用都可以,你這樣,使用phpmyadmin工具,然后把這句話放進去運行
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
這個字段是副表的
回復(fù)@迅??蚣芗夹g(shù)-吳金輝 是不是一定要主表
非常正確
參考文檔:《列表循環(huán)中調(diào)用模塊附表字段》
回復(fù)@迅睿框架技術(shù)-吳金輝 測試回帖
回復(fù)@迅??蚣芗夹g(shù)-吳金輝
我是用在多個站點的,附表做join的方案效率不高。
打算這么干,在A模塊上傳數(shù)據(jù)的時候,同步到B模塊的數(shù)據(jù)里面去,這樣請求B的數(shù)據(jù)的時候,也不用每次都重新查詢一次A了。
所以,怎么在A模塊訪問B模塊的數(shù)據(jù),并修改呢?
模塊字段主附表互轉(zhuǎn)
因為cms字段格式創(chuàng)建好了就無法變更主附表類型,本插件支持將內(nèi)容模塊字段附表字段轉(zhuǎn)移為主...
轉(zhuǎn)為主表