国内流行的内容管理系统(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.

56 lines
1.6KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. *
  5. *
  6. * @version $Id: productimagelist.lib.php 1 9:29 2010年7月6日Z tianya $
  7. * @package DedeBIZ.Taglib
  8. * @copyright Copyright (c) 2022, 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. foreach ($dtp->CTags as $ctag) {
  27. if ($ctag->GetName() == "img") {
  28. $row = array();
  29. $row['imgsrc'] = trim($ctag->GetInnerText());
  30. $row['text'] = $ctag->GetAtt('text');
  31. $images[] = $row;
  32. }
  33. }
  34. }
  35. $dtp->Clear();
  36. $revalue = '';
  37. $ctp = new DedeTagParse();
  38. $ctp->SetNameSpace('field', '[', ']');
  39. $ctp->LoadSource($innerText);
  40. foreach ($images as $row) {
  41. foreach ($ctp->CTags as $tagid => $ctag) {
  42. if (isset($row[$ctag->GetName()])) {
  43. $ctp->Assign($tagid, $row[$ctag->GetName()]);
  44. }
  45. }
  46. $revalue .= $ctp->GetResult();
  47. }
  48. return $revalue;
  49. }