杭州神话信息技术有限公司

标题: 分享至微博 地址解析有错。官方同样问题 [打印本页]

作者: micwolf    时间: 2010-12-30 09:39:47     标题: 分享至微博 地址解析有错。官方同样问题

以官方测试的记事本微博为例
http://t.jishigou.net/profile/share
复制链接代码

  1. <a title="分享到记事狗微博" href="javascript:var d=document,w=window,f='http://t.jishigou.net',l=d.location,e=encodeURIComponent,p=''+e(l.href)+'&t='+e(d.title);if(!w.open(f+'/index.php?mod=share&code=share&url='+p,'','toolbar=0,status=0,width=500,height=400')){l.href=f+'.new'+p;}void(0)"><img src="/http://t.jishigou.net/templates/default/images/shareB.gif" border="0" />分享到记事狗微博</a>
  2.    
复制代码

上述代码 图片不显示

分享按钮链接
http://t.jishigou.net/index.php?mod=share&code=share&url=XXXXXX

也同样出现 分享上图片不显示。IMG的图片地址重复 出现两个http

分析原因是因为 conf site_url 参数解析出错,希望官方给解决方案
作者: micwolf    时间: 2010-12-30 12:21:21

请官方解决下~
作者: micwolf    时间: 2010-12-30 18:12:19

大家都没有这个问题吗?
作者: micwolf    时间: 2010-12-30 20:33:46

图片不显示
作者: ety001    时间: 2010-12-30 21:20:23

我的暂时解决办法是,把src="/http://t.jishigou.net/templates/default/images/shareB.gif"改为src="http://t.jishigou.net/templates/default/images/shareB.gif",就是去掉http前面的那个"/"。
作者: micwolf    时间: 2010-12-30 21:36:35

回复 5# ety001

没用的。你这只是自己改的。其它用户要是想分享,别人是不会改的。
而且上述的分享按钮你点一下,弹出的分享框还是无法显示图片。那个比较难改。
作者: ypf2006    时间: 2010-12-30 21:43:31

发现本地安装的没问题!!!
作者: ypf2006    时间: 2010-12-30 21:45:42

<a title="分享到记事狗" href="javascript:var d=document,w=window,f='http://localhost/JishiGou',l=d.location,e=encodeURIComponent,p=''+e(l.href)+'&t='+e(d.title);if(!w.open(f+'/index.php?mod=share&code=share&url='+p,'','toolbar=0,status=0,width=500,height=400')){l.href=f+'.new'+p;}void(0)"><img src="http://localhost/JishiGou/templates/default/images/shareB.gif" border="0" />分享到记事狗</a>
作者: ypf2006    时间: 2010-12-30 21:47:29

  1. <a title="分享到记事狗" href="javascript:var d=document,w=window,f='http://localhost/JishiGou',l=d.location,e=encodeURIComponent,p=''+e(l.href)+'&t='+e(d.title);if(!w.open(f+'/index.php?mod=share&code=share&url='+p,'','toolbar=0,status=0,width=500,height=400')){l.href=f+'.new'+p;}void(0)"><img src="http://localhost/JishiGou/templates/default/images/shareB.gif" border="0" />分享到记事狗</a>
复制代码
[attach]962[/attach]
作者: ety001    时间: 2010-12-30 22:04:00

回复 6# micwolf
我只是说出了问题原因,原因就是地址错误,只是我找不到在那个源文件里修改,如果能找到该地址在源文件的位置,就OK了
作者: ety001    时间: 2011-1-1 01:37:41

本帖最后由 ety001 于 2011-1-1 01:40 编辑

问题可以这样解决了:
找到\templates\default\profile_main.html的221行
源文件是:
  1. <textarea id="inviteURL1" type="text"  value="" onclick="copyText(this.value);"><a title="分享到{conf site_name}" href="javascript:var d=document,w=window,f='{conf site_url}',l=d.location,e=encodeURIComponent,p=''+e(l.href)+'&t='+e(d.title);if(!w.open(f+'/index.php?mod=share&code=share&url='+p,'','toolbar=0,status=0,width=500,height=400')){l.href=f+'.new'+p;}void(0)"><img src="{conf site_url}/templates/default/images/shareB.gif" border="0" />分享到{conf site_name}</a>
复制代码
需要改为:
  1. <textarea id="inviteURL1" type="text"  value="" onclick="copyText(this.value);"><a title="分享到{conf site_name}" href="javascript:var d=document,w=window,f='{conf site_url}',l=d.location,e=encodeURIComponent,p=''+e(l.href)+'&t='+e(d.title);if(!w.open(f+'/index.php?mod=share&code=share&url='+p,'','toolbar=0,status=0,width=500,height=400')){l.href=f+'.new'+p;}void(0)"><img src={conf site_url}/images/shareB.gif border="0" />分享到{conf site_name}</a>
复制代码
我现在有两点不懂(估计看完模板解析部分的代码能找到答案)。
一个疑点是这段分享代码中用了两次{conf site_url},但是两次的值不同,第一次 f='{conf site_url}' 中{conf site_url}的值是域名值,即http://xx.com,第二次在最后图片引用中{conf site_url}的值变成了http://xx.com/templates/default,这就是为什么大家看到的生成的图片地址里有两编/templates/default/。
第二个疑点是,模板的解析过程可能有问题,因为源文件在生成时,图片引用的地址,总是在最前面加上一个/,即使我手动把{conf site_url}替换成我自己网站的地址,依旧会出现这个问题,即<img src"/http://xx.com/images/shareB.gif border="0" />。最后我发现是那个双引号导致的,把双引号去掉,或者换成单引号,就不存在这个问题了。

希望有人能解答一下。
作者: ety001    时间: 2011-1-1 07:39:29

刚才漏了一个地方,再补充一下,
/templates/default位置的share.html中15行的img标签同上修改方法
作者: e0546    时间: 2011-1-4 15:04:05

谢谢分享




欢迎光临 杭州神话信息技术有限公司 (http://cenwor.com/) Powered by Discuz! X2