欢迎来到路由器窝!

eyoucms自定义图集添加一个注释

浏览次数:

作者: 小编

信息来源:

更新日期: 2022-06-29 10:02

文章简介

打开文件\application\admin\logic\FieldLogic.php搜索imgsIntroArr 找带IMGS case ‘imgs‘: {

  • 正文开始
  • 相关文章

打开文件

\application\admin\logic\FieldLogic.php

搜索imgsIntroArr 找带IMGS

                    case 'imgs':
                    {
                        $imgData = [];
                        $imgsIntroArr = !empty($dataExt[$key.'_eyou_intro']) ? $dataExt[$key.'_eyou_intro'] : [];
                        foreach ($val as $k2 => $v2) {
                            $v2 = trim($v2);
                            if (!empty($v2)) {
                                $imgData[] = [
                                    'image_url' => $v2,
                                    'intro'     => !empty($imgsIntroArr[$k2]) ? $imgsIntroArr[$k2] : '',
                                ];
                            }
                        }
                        $val = serialize($imgData);
                        break;
                    }

更改

                    case 'imgs':
                    {
                        $imgData = [];
                        $imgsIntroArr = !empty($dataExt[$key.'_eyou_intro']) ? $dataExt[$key.'_eyou_intro'] : [];
						$imgsIntroArrs = !empty($dataExt[$key.'_eyou_intros']) ? $dataExt[$key.'_eyou_intros'] : [];
                        foreach ($val as $k2 => $v2) {
                            $v2 = trim($v2);
                            if (!empty($v2)) {
                                $imgData[] = [
                                    'image_url' => $v2,
                                    'intro'     => !empty($imgsIntroArr[$k2]) ? $imgsIntroArr[$k2] : '',
									'intros'     => !empty($imgsIntroArrs[$k2]) ? $imgsIntroArrs[$k2] : '',
                                ];
                            }
                        }
                        $val = serialize($imgData);
                        break;
                    }

打开文件\application\admin\model\Field.php搜索 imgsIntroArr

                    case 'imgs':
                    {
                        $imgData = [];
                        $imgsIntroArr = !empty($dataExt[$key.'_eyou_intro']) ? $dataExt[$key.'_eyou_intro'] : [];
                        foreach ($val as $k2 => $v2) {
                            $v2 = trim($v2);
                            if (!empty($v2)) {
                                $intro = !empty($imgsIntroArr[$k2]) ? $imgsIntroArr[$k2] : '';
                                $imgData[] = [
                                    'image_url' => $v2,
                                    'intro'     => $intro,
                                ];
                            }
                        }
                        $val = !empty($imgData) ? serialize($imgData) : '';
                        break;
                    }

更改成

                    case 'imgs':
                    {
                        $imgData = [];
                        $imgsIntroArr = !empty($dataExt[$key.'_eyou_intro']) ? $dataExt[$key.'_eyou_intro'] : [];
						$imgsIntroArrs = !empty($dataExt[$key.'_eyou_intros']) ? $dataExt[$key.'_eyou_intros'] : [];
                        foreach ($val as $k2 => $v2) {
                            $v2 = trim($v2);
                            if (!empty($v2)) {
                                $intro = !empty($imgsIntroArr[$k2]) ? $imgsIntroArr[$k2] : '';
								$intros = !empty($imgsIntroArrs[$k2]) ? $imgsIntroArrs[$k2] : '';
                                $imgData[] = [
                                    'image_url' => $v2,
                                    'intro'     => $intro,
									'intros'     => $intros,
                                ];
                            }
                        }
                        $val = !empty($imgData) ? serialize($imgData) : '';
                        break;
                    }

打开\application\admin\template\field\addonextitem.htm搜索“图片注释”

<div class="tab-pane pics" id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
                          <!-- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="imgupload">
                                <i class="fa fa-photo"></i>上传图片
                            </a> -->
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td >
                                        <div class="sort-list-{$vo.fieldArr}_{$vo.name|default=''}">
                                            {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
                                            <div class="images_upload images_upload_html" style="display:inline-block;">
                                                <div style="position: relative; height: 130px;">
                                                    <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2['image_url']}">
                                                    <a href="{$v2['image_url']}" onclick="" class="upimg" target="_blank" title="拖动修改排序">
                                                        <img src="{$v2['image_url']}" width="136" height="136">
                                                    </a>
                                                    <a href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2['image_url']}')" class="delect" title="删除"></a>
                                                </div>
                                                <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" style="height:28px; width: 136px;" placeholder="图片注释">{$v2.intro}</textarea>
                                            </div>
                                            {/volist}
                                            <div class="images_upload"></div>
                                        </div>
                                        <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');"  class="img-upload mb15" title="点击上传">
                                             <div class="y-line"></div>
                                             <div class="x-line"></div>
                                         </a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <!-- 上传图片显示的样板 start -->
                        <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl none">
                            <div class="images_upload images_upload_html" style="display:inline-block;">
                                <div style="position: relative; height: 130px;">
                                    <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
                                    <a href="javascript:void(0);" onClick="" class="upimg" title="拖动修改排序">
                                        <img src="__STATIC__/admin/images/add-button.jpg" width="136" height="136" />
                                    </a>
                                    <a href="javascript:void(0)" class="delect" title="删除">&nbsp;&nbsp;</a>
                                </div>
                                <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" style="height:28px; width: 136px;" placeholder="图片注释"></textarea>
                            </div>
                        </div>

修改成

<div class="tab-pane pics" id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
                          <!-- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');" class="imgupload">
                                <i class="fa fa-photo"></i>上传图片
                            </a> -->
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td >
                                        <div class="sort-list-{$vo.fieldArr}_{$vo.name|default=''}">
                                            {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
                                            <div class="images_upload images_upload_html" style="display:inline-block;">
                                                <div style="position: relative; height: 130px;">
                                                    <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2['image_url']}">
                                                    <a href="{$v2['image_url']}" onclick="" class="upimg" target="_blank" title="拖动修改排序">
                                                        <img src="{$v2['image_url']}" width="136" height="136">
                                                    </a>
                                                    <a href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2['image_url']}')" class="delect" title="删除"></a>
                                                </div>
                                                <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" style="height:28px; width: 136px;" placeholder="图片注释">{$v2.intro}</textarea></br>
												<textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intros][]" style="height:28px; width: 136px;" placeholder="图片注释">{$v2.intros}</textarea>
                                            </div>
                                            {/volist}
                                            <div class="images_upload"></div>
                                        </div>
                                        <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back');"  class="img-upload mb15" title="点击上传">
                                             <div class="y-line"></div>
                                             <div class="x-line"></div>
                                         </a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <!-- 上传图片显示的样板 start -->
                        <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl none">
                            <div class="images_upload images_upload_html" style="display:inline-block;">
                                <div style="position: relative; height: 130px;">
                                    <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
                                    <a href="javascript:void(0);" onClick="" class="upimg" title="拖动修改排序">
                                        <img src="__STATIC__/admin/images/add-button.jpg" width="136" height="136" />
                                    </a>
                                    <a href="javascript:void(0)" class="delect" title="删除">&nbsp;&nbsp;</a>
                                </div>
                                <textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intro][]" style="height:28px; width: 136px;" placeholder="图片注释"></textarea></br>
								<textarea rows="5" cols="60" name="{$vo.fieldArr}[{$vo.name|default=''}_eyou_intros][]" style="height:28px; width: 136px;" placeholder="图片注释"></textarea>
                            </div>
                        </div>

data/schema

将:ey_article_content.php 

ey_images_upload.php

ey_product_img.php文件改名或者删除。

 添加数据字段

ALTER TABLE ey_product_img  ADD  intros  varchar(500) NOT NULL DEFAULT '' COMMENT '图集链接';
ALTER TABLE ey_images_upload  ADD  intros  varchar(500) NOT NULL DEFAULT '' COMMENT '图集链接';

打开文件\application\admin\model\ImagesUpload.php找到:关键词:

public function saveimg($aid, $post = array())

在大概68行

$imgintro = isset($post['imgintro']) ? $post['imgintro'] : array();

下面新增以下内容:

$imgintros = isset($post['imgintros']) ? $post['imgintros'] : array();

大概在97行左右

$intro = !empty($imgintro[$key]) ? $imgintro[$key] : '';

下面新增:

$intros  = !empty($imgintros[$key]) ? $imgintros[$key] : '';

103行左右:

'intro'   => $intro,

下面新增:

'intros'   => $intros,

打开\application\admin\template\images\add.htm

关键词: <label>图片集</label>

<textarea rows="5" cols="60" name="imgintro[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intro}{/literal}"></textarea>

下面新增以下代码:

</br>
<textarea rows="5" cols="60" name="imgintros[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intros}{/literal}"></textarea>

打开\application\admin\template\images\edit.htm

关键词: <label>图片集</label>

大概124行

  <textarea rows="5" cols="60" name="imgintro[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intro}{/literal}">{$vo.intro}</textarea>

下面新增以下代码:

</br>
<textarea rows="5" cols="60" name="imgintros[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intros}{/literal}">{$vo.intros}</textarea>

再继续往下找到:

 <textarea rows="5" cols="60" name="imgintro[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intro}{/literal}"></textarea>

再下面一行新增:

</br>
<textarea rows="5" cols="60" name="imgintros[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intros}{/literal}"></textarea>

产品页修改:

打开\application\admin\model\ProductImg.php

搜索关键词:  

public function saveimg($aid, $post = array())

(大概66行)

$imgintro = isset($post['imgintro']) ? $post['imgintro'] : array();

下面新增以下内容:

$imgintros = isset($post['imgintros']) ? $post['imgintros'] : array();

大概在95行左右

$intro = !empty($imgintro[$key]) ? $imgintro[$key] : '';

下面新增:

$intros  = !empty($imgintros[$key]) ? $imgintros[$key] : '';

101行左右:

'intro'   => $intro,

下面新增:

'intros'   => $intros,

打开文件\application\admin\template\product\add.htm

关键词: <label>图片集</label>

大概184行 

 <textarea rows="5" cols="60" name="imgintro[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intro}{/literal}"></textarea>

下面新增以下代码:

</br>
<textarea rows="5" cols="60" name="imgintros[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intros}{/literal}"></textarea>

打开文件\application\admin\template\product\edit.htm

关键词: <label>图片集</label>

大概124行

 <textarea rows="5" cols="60" name="imgintro[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intro}{/literal}">{$vo.intro}</textarea>

下面新增以下代码:

</br>
<textarea rows="5" cols="60" name="imgintros[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intros}{/literal}">{$vo.intros}</textarea>


再继续往下找到:

 <textarea rows="5" cols="60" name="imgintro[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intro}{/literal}"></textarea>

再下面一行新增:

</br>
<textarea rows="5" cols="60" name="imgintros[]" style="height:28px; width: 136px;" placeholder="图片注释" title="标签调用:{literal}{$field.intros}{/literal}"></textarea>

调用方法:

{$field.intros}

涉及到的文件

\application\admin\logic\FieldLogic.php
\application\admin\model\Field.php
\application\admin\template\field\addonextitem.htm
\application\admin\model\ImagesUpload.php
\application\admin\template\images\add.htm
\application\admin\template\images\edit.htm
\application\admin\model\ProductImg.php
\application\admin\template\product\add.htm
\application\admin\template\product\edit.htm

注释:

标签里面的字段intros  是我随意写的。 但是一定要统一!

数据库跟文件 都要一样即可!

自定义多图的图集 不涉及数据库 他是test记录的形式 自动写入数据表 而系统自带的图集则要涉及数据库



转载请注明:eyoucms» eyoucms自定义图集添加一个注释

标签:
上一页:EYOUCMS瀑布流自动加载静态正常
没有了
最近更新作品
eyoucms自定义图集添加一个注释
更新时间:2022-06-29

652人已经看过了!

EYOUCMS瀑布流自动加载静态正常
更新时间:2021-12-25

835人已经看过了!

eyoucms筛选里面调用其他频道数据自定义数据
更新时间:2021-12-19

675人已经看过了!