半点优化网 http://www.bdxc.net/
当前位置首页 > 网站建设> 正文

zblogphp的发表的文章在源码哪个文件夹

2022-05-07 04:38:03 暂无评论 272 网站建设 文件夹   源码   zblogphp

1、新建广告文件在模板文件夹内建一个文件作为放广告代码的文件(这里暂且命名为:post-ad.php)2、修改模板文件找到 \zb_users\theme\default\template\index.php (default根据你自己的模板为准)这个文件找到下面这段代码:PHP{foreach $articles as $article}{if $article.IsTop}{template:post-istop}{else}{template:post-multi}{/if}{/foreach}如果你只想在置顶列表里加入广告那么将上面的代码替换为:PHP{php}$j=1;{/php}{foreach $articles as $article} {if $article.IsTop} {template:post-istop} {if $j==3} {template:post-ad} (这里也可以不调用,直接放广告代码) {/if} {php}$j++;{/php} {else} {template:post-multi} {/if}{/foreach}(数字3为广告出现的位置,post-ad 为第一步建的文件名,下同)如果你想在除置顶列表外加入广告那么将上面的代码替换为:PHP{php}$i=1;{/php}{foreach $articles as $article} {if $article.IsTop} {template:post-istop} {else} {template:post-multi} {if $i==3} {template:post-ad} {/if} {php}$i++;{/php} {/if}{/foreach}上面两个位置同时出现的代码为:PHP{php}$i=1;$j=1;{/php}{foreach $articles as $article} {if $article.IsTop} {template:post-istop} {if $j==3} {template:post-ad} {/if} {php}$j++;{/php} {else} {template:post-multi} {if $i==3} {template:post-ad} {/if} {php}$i++;{/php} {/if}{/foreach}

文章信息分为两个部分,一部分是文字及各种附件路径值存储在数据库内,另一部分是附件如图片、上传的视频等,存储在zb_users\upload,按年月方式展示,打开就可以看到

猜你喜欢