root
root
3353 2 0

怎样添加图片alt声明

@admin
1、发现发布的文章中图片后面都有提供alt标签
今天折腾了一天想把alt加上文章标题函数,这样做可以对每张图片都自动加上alt,从而达到相对理想的seo手段,但是折腾了一天也没找到在哪加上标题函数
2、想去掉首页、文章页面显示用户名的函数和链接,但是删除掉用户名函数链接之后,网站直接空白
希望@admin 给个教程

0

See Also

Nearby


Discussion (2)

admin
admin 2014-02-05 08:07

1)给common.php 里的 set_content 函数再多加个参数传入title 信息,如

set_content($text, $spider='0', $title=''){
......
        if(!$spider){
            $text = preg_replace($qq_img_re, '<img src="'.$options['base_url'].'/static/grey2.gif" data-original="\1/460" alt="'.$title.'" />', $text);
        }else{
            $text = preg_replace($qq_img_re, '<img src="\1/460" alt="" />', $text);
        }
......
}

在topicpage.php 里找到调用 set_content 的地方,传递标题参数,如:

$t_obj['content'] = set_content($t_obj['content'], 1, $t_obj['title']);

2)删除时注意所用的符号,如单引号、双引号、点号,不小心会出错。
如下面这一行,
https://github.com/ego008/youbbs/blob/master/templates/default/home.php#L30
原来是:

<span class="item-date"><a href="/n-',$article['cid'],'">',$article['cname'],'</a>  •  <a href="/member/',$article['uid'],'">',$article['author'],'</a>';

删掉后:

<span class="item-date"><a href="/n-',$article['cid'],'">',$article['cname'],'</a>  ';
0
root
root 2014-02-05 11:44

@admin 嗯首页清除了显示用户名和用户名链接,但是文章还是依旧显示用户名和用户名链接~

0
Login Topics