如果大家访问过基于Chevereto搭建的图床,可能会看到一些图床的首页有托管图片的数量统计,通过查询,找到了实现方式,特记录在此,方便自己后期查询也方便有此需求的你。
修改首页代码
修改 index.php 文件,位置:/chevereto/app/themes/Peafowl/views/index.php,找到下述代码:
<div class="home-buttons">
......
</div>
在下面添加下述代码:
<p id="home-cover-msg">
<?php echo CHV\getSetting('homepage_paragraph_html') ?: _s('<span class=\'image-count\'>%s</span> images hosted', get_totals()['images'] > 999999 ? get_totals_display()['images'] : number_format(get_totals()['images'])); ?>
</p>
修改后台代码
修改 route.index.php 文件,位置:/chevereto/app/routes/route.index.php,找到下述代码:
$handler::setVar('doctitle', CHV\Settings::get('website_doctitle'));
$handler::setVar('pre_doctitle', CHV\Settings::get('website_name'));
在此后添加代码:
$handler::setVar('totals', CHV\Stat::getTotals());
通过以上两步即可实现。
6 comments
教程过期了 不适合V4
再来看看
我买了个chevereto,多次都安装失败,博主抽空可否帮看下呢OωO
提示什么呢
广告有点多,发表评论四个字也被遮住了六分之一,也许是我的显示屏不够大。
|´・ω・)ノ常年开着去广告。。。