How to Call Discuz!X Forum Data from PHPCMS v9

 After about a month of exploringPHPCMS v9, I have a general understanding of its features. Before building the site, I planned to integrate DZ X1.5. I found methods for synchronization in forums, but got little help on calling forum posts – probably because it’s too simple for anyone to write about, so I’ll organize it here. If it helps, please give me a thumbs up – I’m a beginner and need encouragement.

  1. First, about database setup. If you have V9 and DZ in the same database, skip this step. If they are in separate databases, search the PC forum for posts about external data sources.

  2. Let me introduce commonly used data tables in DZX1.5:

  My database prefix is bbs

  bbs_x_forum_thread is the main table for forum posts

  It contains: thread ID (tid), forum ID (fid), thread title (subject), views, digest level

  For those who understand SQL, I recommend installing phpmyadmin to look at the database structure.

  As named in DZ backend, forum is the forum square, home is the homestead. Tables prefixed with _forum_ are related to forum data.

  3. Example Calls

  1. Calling the most recent posts from the entire forum (using tid in descending order)

{pc:get sql="SELECT * FROM bbs_forum_thread order by tid desc" cache="3600" return="data" num="10"}{loop $data $key $val}{str_cut($val[subject],28,'')}{/loop}{/pc}

  accessmssql select top 10 * form ,

  mysqllimit pcTaglimit num。

  2、(views)

{pc:get sql="SELECT * FROM bbs_forum_thread order by views desc" cache="3600" return="data" num="10"}{loop $data $key $val}{str_cut($val[subject],28,'')}{/loop}{/pc}

  3、(fiddz—— ID)

{pc:get sql="SELECT * FROM bbs_forum_thread where fid in(46,47) order by views desc" cache="3600" return="data" num="10"}{loop $data $key $val}{str_cut($val[subject],28,'')}{/loop}{/pc}

  4、()

{pc:get sql="SELECT * FROM bbs_forum_thread where fid=47 order by digest desc" cache="3600" return="data" num="10"}{loop $data $key $val}{str_cut($val[subject],28,'')}{/loop}{/pc}

  5、( ??dz———— )

{pc:get sql="SELECT * FROM bbs_forum_forum where fum=37 order by displayorder asc" cache="3600" return="data" num="10"}{loop $data $key $val}{str_cut($val[subject],28,'')}{/loop}{/pc}

  “” gid=37() fumgid

  V9,V9,dz,

  ,,,,,sql,

{pc:get sql="SELECT a.tid,a.H_room,a.H_area,a.H_rents,b.subject FROM bbs_category_sortvalue3 a INNER JOIN bbs_category_house_thread b on a.tid = b.tid order by a.tid desc" num="6" page="$page"}{loop $data $r}{str_cut($r[subject],20)}{$r[H_room]}{$r[H_area]}{if $r[H_rents]>0}{$r[H_rents]}{else}{/if}{/loop}{/pc}

  dzCategory Category bbs_category_sortvalue1 bbs_category_sortvalue2

  bbs_category_sortvalue3。

  h_room h_area h_rents,dz,sql。

SELECT a.tid,a.H_room,a.H_area,a.H_rents,b.subject FROM bbs_category_sortvalue3 a INNER JOIN bbs_category_house_thread b on a.tid = b.tid order by a.tid desc

  :bbs_category_sortvalue3 a bbs_category_sortvalue3 a ,

  bbs_category_house_thread b bbs_category_house_thread b

  select _______ from a inner join b on a.tid=b.tid atid = b tid

  , a.tid,a.H_room,a.H_area,a.H_rents,b.subject a.tid,。

  。

Leave a Comment

Your email address will not be published.