Js dynamic retrieval of the article content in the dedeCMS system
- Require_once (dirname (_ FILE _). "/include/common. inc. php ");
- Require_once (DEDEINC. "/typelink. class. php ");
- Require_once (DEDEINC. "/channelunit. func. php ");
- $ T1 = ExecTime ();
- $ Pai_multi_site = 'y'; // enable absolute path
- /** Post call
- * Parameter description
- * $ ID of the tid column
- * $ Flg article attributes
- * $ Num the default number of retrieved items is 6.
- * $ Order the sorting of articles is reliable (the default sorting of articles is pubdate and inverted)
- * $ Class-controlled style name, used to retrieve multiple styles that control different styles on a page. the default value is jsArticle.
- * $ How many articles pass by the skip?
- **/
- // $ Tid = 10;
- // $ Flg = 'a, c ';
- // $ Num = 20;
- If (! (Isset ($ tid) & is_numeric ($ tid )))
- {
- $ Tid = 0;
- }
- If (! (Isset ($ num) & is_numeric ($ num )))
- {
- $ Num = 6;
- }
- If (! Isset ($ class ))
- {
- $ Class = 'jsarticle ';
- }
- If (! (Isset ($ skip) & is_numeric ($ skip )))
- {
- $ Skip = 0;
- }
- $ Query = "Select 'id', 'typeid', 'senddate', 'title', 'ismake', 'arcrank ', 'Money ', 'filename' from '# @__ archives 'Where 1 = 1 ";
- If ($ tid)
- {
- $ Query. = "and 'typeid' = '{$ tid }'";
- }
- If (isset ($ flg ))
- {
- // $ Query. = "and (1> 1 ";
- $ Flgs = explode (',', $ flg );
- Foreach ($ flgs as $ v)
- {
- $ Query. = "and FIND_IN_SET ('{$ v}', 'flag')> 0 ";
- }
- // $ Query. = ")";
- }
- If (isset ($ order ))
- {
- $ Query. = "order by {$ order} desc ";
- }
- Else
- {
- $ Query. = "order by pubdate desc ";
- }
- $ Query. = "limit {$ skip}, {$ num }";
- $ Dsql-> Execute ('me', $ query );
- While (false! = ($ Row = $ dsql-> GetArray ('me ')))
- {
- $ TypeLink = new TypeLink ($ row ["typeid"]);
- $ Arclink = GetFileUrl (
- $ Row ['id'],
- $ Row ["typeid"],
- $ Row ["senddate"],
- $ Row ["title"],
- $ Row ["ismake"],
- $ Row ["arcrank"],
- $ TypeLink-> TypeInfos ['namerule'],
- $ TypeLink-> TypeInfos ['typedir'],
- $ Row ["money"],
- $ Row ['filename'],
- $ TypeLink-> TypeInfos ['moresite '],
- $ TypeLink-> TypeInfos ['siteurl'],
- $ TypeLink-> TypeInfos ['sitepath']
- );
- Unset ($ TypeLink );
- $ Row ['URL'] = $ arclink;
- $ Rows [] = $ row;
- }
- Echo "document. write ('
');";
- Foreach ($ rows as $ row)
- {
- Echo "document. write ('
- {$ Row ['title']}
');";
- }
- Echo "document. write ('
');";
- $ T2 = ExecTime ();
- /* Echo 'execution time ';
- Echo $ t2-$ t1 ;*/
- ?>