如何在自定义字段中插入html代码和标签
在自定义字段里面直接插入html代码还有标签是解析不出来的.
但是我们可以通过以下的方法来实现.
1.添加一个自定义字段.命名为my_zdy
修 改 字 段 属 性
所有同类频道 当前频道
单行文本多行文本下拉列表图片文件日期
|||
是 否
一般来说调用这个自定义字段的标签就是{$my_zdy},可是我们假如直接在自定义字段中插入html代码或者是标签的时候,或在内容页原封不动的显示出来(可能是自动生成的{$my_zdy}标签输出字段时的过滤处理自动设置成不解析.).我们有什么办法让他解析呢?虽然这个{$my_zdy}标签的内容不解析,可是我们打开数据库,是可以看到这个自定义字段的内容的,内容就保存在pe_article表的my_zdy字段里面.下面我们用一个自定义函数标签把这个字段的内容读出来
2. 增加一个自定义函数标签.设置如下
添 加 动 态 标 签(第一步)
}|||
ðâôö·öàà
±ê×¼¶¯ì¬±êç© º¯êýðí¶¯ì¬±êç©
çëñ¡ôñò»¸ö±ípe_advertisementpe_adzonepe_announcepe_areacollectionpe_articlepe_authorpe_bankpe_bankrollitempe_cardpe_channelpe_citype_classpe_classroompe_clientpe_commentpe_companype_complainitempe_consumelogpe_contacterpe_copyfrompe_countrype_deliverchargepe_deliveritempe_delivertypepe_dictionarype_downerrorpe_downserverpe_equipmentpe_favoritepe_fieldpe_filterspe_friendpe_friendsitepe_fskindpe_guestbookpe_guestkindpe_histrolynewspe_houseareape_houseconfigpe_housecspe_houseczpe_househzpe_houseqgpe_houseqzpe_infospe_invoiceitempe_itempe_jobcategorype_jsfilepe_keylinkpe_labelpe_logpe_messagepe_mype_newkeyspe_notdownpe_orderformpe_orderformitempe_pagepe_pageclasspe_paymentpe_paymenttypepe_photope_positionpe_positionsupplyinfope_presentprojectpe_producerpe_productpe_provincepe_rechargelogpe_resumepe_serviceitempe_shoppingcartspe_skinpe_softpe_spacepe_spacebookpe_spacecommentpe_spacediarype_spacekindpe_spacelinkpe_spacemusicpe_spacephotope_spacevisitorpe_specialpe_subcompanype_supplype_supply_companype_surveype_surveyanswerpe_surveyinputpe_surveyquestionpe_surveyrecordpe_templatepe_templateprojectpe_trademarkpe_transferitempe_useddetailpe_userpe_usergrouppe_votepe_workplace|||
请选择一个表pe_advertisementpe_adzonepe_announcepe_areacollectionpe_articlepe_authorpe_bankpe_bankrollitempe_cardpe_channelpe_citype_classpe_classroompe_clientpe_commentpe_companype_complainitempe_consumelogpe_contacterpe_copyfrompe_countrype_deliverchargepe_deliveritempe_delivertypepe_dictionarype_downerrorpe_downserverpe_equipmentpe_favoritepe_fieldpe_filterspe_friendpe_friendsitepe_fskindpe_guestbookpe_guestkindpe_histrolynewspe_houseareape_houseconfigpe_housecspe_houseczpe_househzpe_houseqgpe_houseqzpe_infospe_invoiceitempe_itempe_jobcategorype_jsfilepe_keylinkpe_labelpe_logpe_messagepe_mype_newkeyspe_notdownpe_orderformpe_orderformitempe_pagepe_pageclasspe_paymentpe_paymenttypepe_photope_positionpe_positionsupplyinfope_presentprojectpe_producerpe_productpe_provincepe_rechargelogpe_resumepe_serviceitempe_shoppingcartspe_skinpe_softpe_spacepe_spacebookpe_spacecommentpe_spacediarype_spacekindpe_spacelinkpe_spacemusicpe_spacephotope_spacevisitorpe_specialpe_subcompanype_supplype_supply_companype_surveype_surveyanswerpe_surveyinputpe_surveyquestionpe_surveyrecordpe_templatepe_templateprojectpe_trademarkpe_transferitempe_useddetailpe_userpe_usergrouppe_votepe_workplace|||
articleidchannelidclassidtitletitleintactsubheadingauthorcopyfrominputerlinkurleditorkeywordhitscommentcountupdatetimecreatetimeontopelitestatuscontentincludepicdefaultpicurluploadfilesinfopointpaginationtypedeletedskinidtemplateidstarstitlefontcolortitlefonttypemaxcharperpageshowcommentlinkreceivereceiveuserreceivedautoreceivetimereceivetypeintropresentexpcopymoneyispayedbeneficiarypaydatevoteidinfopurviewarrgroupidchargetypepitchtimereadtimesdividepercentblogidmy_111my_标题my_内容my_zdy
>>>>
请先选择一个表articleid|||
{$now}
{$nowday}
{$nowmonth}
{$nowyear}
select my_zdy from pe_article where articleid={input(0)}
添 加 函 数 型 动 态 标 签(第二步)
select my_zdy from pe_article where articleid={input(0)}
my_zdy
{$now}
{$nowday}
{$nowmonth}
{$nowyear}
{$autoid}
{$totalput}
articleid|||
标 签 内 容
{loop}{infobegin}{$field(0,text,0,0,0)}{infoend}{/loop}
这个动态函数标签的作用就是根据文章id读取这个文章的自定义字段的值,当然,我们这个自定义函数标签的过滤处理是要选择解析html标记的.
3在内容页模版中我们插入{$my_读取自定义字段({$articleid})}
4添加一篇文章.|||然后在自定义字段那里写入标签名或者html代码,添加完看效果,可以解析出来了吧.
至于是不是所有标签加在自定义字段里面都能解析出来..这个还需要你自己动手尝试一下.