国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6KB

  1. <?php
  2. !defined('DEDEINC') && exit("403 Forbidden!");
  3. /**
  4. *
  5. *
  6. * @version $Id: productimagelist.lib.php 1 9:29 2010年7月6日Z tianya $
  7. * @package DedeCMS.Taglib
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license
  10. * @link https://www.dedebiz.com
  11. */
  12. function lib_productimagelist(&$ctag, &$refObj)
  13. {
  14. global $dsql,$sqlCt;
  15. $attlist="desclen|80";
  16. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  17. extract($ctag->CAttribute->Items, EXTR_SKIP);
  18. if(!isset($refObj->addTableRow['imgurls'])) return ;
  19. $revalue = '';
  20. $innerText = trim($ctag->GetInnerText());
  21. if(empty($innerText)) $innerText = GetSysTemplets('productimagelist.htm');
  22. $dtp = new DedeTagParse();
  23. $dtp->LoadSource($refObj->addTableRow['imgurls']);
  24. $images = array();
  25. if(is_array($dtp->CTags))
  26. {
  27. foreach($dtp->CTags as $ctag)
  28. {
  29. if($ctag->GetName()=="img")
  30. {
  31. $row = array();
  32. $row['imgsrc'] = trim($ctag->GetInnerText());
  33. $row['text'] = $ctag->GetAtt('text');
  34. $images[] = $row;
  35. }
  36. }
  37. }
  38. $dtp->Clear();
  39. $revalue = '';
  40. $ctp = new DedeTagParse();
  41. $ctp->SetNameSpace('field','[',']');
  42. $ctp->LoadSource($innerText);
  43. foreach($images as $row)
  44. {
  45. foreach($ctp->CTags as $tagid=>$ctag)
  46. {
  47. if(isset($row[$ctag->GetName()])){ $ctp->Assign($tagid,$row[$ctag->GetName()]); }
  48. }
  49. $revalue .= $ctp->GetResult();
  50. }
  51. return $revalue;
  52. }